Merge pull request #1746 from thelounge/xpaw/fix-preview-keep-to-bottom

Trigger keep to bottom for previews correctly
This commit is contained in:
Jérémie Astori 2017-11-26 12:35:08 -05:00 committed by GitHub
commit d9efaef369
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}