From 6862c2e6b0f56d78cf0055d9530f167191f208cf Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 26 Nov 2017 15:49:31 +0200 Subject: [PATCH] Trigger keep to bottom for previews correctly --- client/js/renderPreview.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/js/renderPreview.js b/client/js/renderPreview.js index c060e744..626e0f83 100644 --- a/client/js/renderPreview.js +++ b/client/js/renderPreview.js @@ -29,12 +29,12 @@ function renderPreview(preview, msg) { preview.shown = preview.shown && options.shouldOpenMessagePreview(preview.type); - const container = msg.closest(".chat"); - const channelId = container.data("id"); - const activeChannelId = chat.find(".chan.active").data("id"); + const container = msg.closest(".messages"); + const channelId = container.closest(".chan").data("id") || -1; + const activeChannelId = chat.find(".chan.active").data("id") || -2; let bottom = false; - if (container.length && activeChannelId === channelId) { + if (activeChannelId === channelId) { bottom = container.isScrollBottom(); }