Fix handling preview More buttons on inactive channels

This commit is contained in:
Jérémie Astori 2018-04-07 02:47:49 -04:00
parent 527cac4c75
commit 5bff07f6f6
No known key found for this signature in database
GPG key ID: B9A4F245CD67BDE8

View file

@ -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;