From 5c64eaf41e29527957ffc1904dfeffedb36f7132 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 5 Jan 2020 18:27:34 +0200 Subject: [PATCH 1/2] Show an icon for "show in active" messages --- client/components/Message.vue | 6 ++++++ client/css/style.css | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/client/components/Message.vue b/client/components/Message.vue index 12ce0917..757a90b5 100644 --- a/client/components/Message.vue +++ b/client/components/Message.vue @@ -58,6 +58,12 @@ + Date: Sun, 5 Jan 2020 18:30:56 +0200 Subject: [PATCH 2/2] Remove showInActive if active network differs --- client/js/socket-events/msg.js | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/client/js/socket-events/msg.js b/client/js/socket-events/msg.js index 283deba0..a5ea7783 100644 --- a/client/js/socket-events/msg.js +++ b/client/js/socket-events/msg.js @@ -29,25 +29,29 @@ socket.on("msg", function(data) { // Display received notices and errors in currently active channel. // Reloading the page will put them back into the lobby window. - // We only want to put errors/notices in active channel if they arrive on the same network - if ( - data.msg.showInActive && - store.state.activeChannel && - store.state.activeChannel.network === receivingChannel.network - ) { - channel = store.state.activeChannel.channel; + if (data.msg.showInActive) { + // We only want to put errors/notices in active channel if they arrive on the same network + if ( + store.state.activeChannel && + store.state.activeChannel.network === receivingChannel.network + ) { + channel = store.state.activeChannel.channel; - if (data.chan === channel.id) { - // If active channel is the intended channel for this message, - // remove the showInActive flag - data.msg.showInActive = false; + if (data.chan === channel.id) { + // If active channel is the intended channel for this message, + // remove the showInActive flag + delete data.msg.showInActive; + } else { + data.chan = channel.id; + } } else { - data.chan = channel.id; + delete data.msg.showInActive; } - } else if (!isActiveChannel) { - // Do not set unread counter for channel if it is currently active on this client - // It may increase on the server before it processes channel open event from this client + } + // Do not set unread counter for channel if it is currently active on this client + // It may increase on the server before it processes channel open event from this client + if (!isActiveChannel) { if (typeof data.highlight !== "undefined") { channel.highlight = data.highlight; }