From 5bff07f6f67cdc6424f4f7de53a7892b9a4de82f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sat, 7 Apr 2018 02:47:49 -0400 Subject: [PATCH] Fix handling preview More buttons on inactive channels --- client/js/renderPreview.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/js/renderPreview.js b/client/js/renderPreview.js index 5b4567f3..0887ac02 100644 --- a/client/js/renderPreview.js +++ b/client/js/renderPreview.js @@ -59,7 +59,8 @@ function appendPreview(preview, msg, template) { } const container = msg.closest(".chat"); - const channelId = container.closest(".chan").data("id") || -1; + const channel = container.closest(".chan"); + const channelId = channel.data("id") || -1; const activeChannelId = chat.find(".chan.active").data("id") || -2; msg.find(`.text a[href="${escapedLink}"]`) @@ -72,7 +73,7 @@ function appendPreview(preview, msg, template) { const previewContent = previewContainer.find(".toggle-content")[0]; const showMoreIfNeeded = () => { - if (preview.type === "link") { + if (preview.type === "link" && channel.hasClass("active")) { const isVisible = moreBtn.is(":visible"); const shouldShow = previewContent.offsetWidth >= previewContainer[0].offsetWidth;