From c066f25b171eb7fe2e6a02b045c968e3095f70af Mon Sep 17 00:00:00 2001 From: Awal Garg Date: Thu, 6 Apr 2017 00:45:28 +0530 Subject: [PATCH] fix: count only message items for show-more the `messages` div contains a `date-marker` div and an `unread-marker` div. this causes the `count` variable to be 2 more than the expected value, which makes the show-more button skip two messages when loading history. this change filters the counted elements to fix this issue. --- client/js/lounge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index fa3ec21d..3edd49dc 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -1189,7 +1189,7 @@ $(function() { chat.on("click", ".show-more-button", function() { var self = $(this); - var count = self.parent().next(".messages").children().length; + var count = self.parent().next(".messages").children(".msg").length; socket.emit("more", { target: self.data("id"), count: count