From 76863cd017b39e79a27d410ac3bfb47174dbcf5f Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 9 Oct 2017 04:47:51 +0000 Subject: [PATCH] Fix dupe click mentioning --- webapp/titanembeds/static/js/embed.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index dceb298..cb7b7d2 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -854,6 +854,12 @@ handle_last_message_mention(); $("#chatcontent p:last-child").find(".blockcode").find("br").remove(); // Remove excessive breaks in codeblocks render_code_highlighting($("#chatcontent p:last-child").find(".blockcode")); + $("#chatcontent .chatusername").last().click(function () { + var discordid = $(this).parent().attr("discord_userid"); + if (discordid) { + mention_member(discordid); + } + }); } else { replace.html($(rendered).html()); replace.find(".blockcode").find("br").remove(); @@ -865,7 +871,6 @@ } if (!(usrcachekey in message_users_cache)) { message_users_cache[usrcachekey] = {"data": {}, "msgs": []}; - } message_users_cache[usrcachekey]["msgs"].push(message.id); last = message.id; @@ -877,12 +882,6 @@ target: "_blank" }); $('.tooltipped').tooltip(); - $("#chatcontent .chatusername").click(function () { - var discordid = $(this).parent().attr("discord_userid"); - if (discordid) { - mention_member(discordid); - } - }); process_message_users_cache(); return last; }