From 0433040edea5aaa9d3c895ab0beb27dd8f4a6251 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sat, 31 Mar 2018 04:48:48 +0000 Subject: [PATCH] Attempt to fix when message delete and no more messages present --- webapp/titanembeds/static/js/embed.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index 534e283..0ad780b 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -1733,11 +1733,11 @@ return; } $("#discordmessage_"+msg.id).parent().remove(); - var lastelem = $("#chatcontent").find("[id^=discordmessage_]").last(); - if (!lastelem.length) { - last_message_id = null; + var lastelem = $("#chatcontent").find("[id^=discordmessage_]"); + if (lastelem.length) { + last_message_id = lastelem.last().attr('id').substring(15); } else { - last_message_id = lastelem.attr('id').substring(15); + last_message_id = null; } });