From 9db1d0f7c8a9efb8821669b01c16f3dc1d4cdb0b Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 17 Feb 2020 17:02:34 +0200 Subject: [PATCH] Fix incorrectly updating unread counter for 'show in active' messages --- client/js/socket-events/msg.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/js/socket-events/msg.js b/client/js/socket-events/msg.js index 855ef2ad..4a5b9cd2 100644 --- a/client/js/socket-events/msg.js +++ b/client/js/socket-events/msg.js @@ -24,7 +24,7 @@ socket.on("msg", function(data) { } let channel = receivingChannel.channel; - const isActiveChannel = + let isActiveChannel = store.state.activeChannel && store.state.activeChannel.channel === channel; // Display received notices and errors in currently active channel. @@ -37,6 +37,10 @@ socket.on("msg", function(data) { ) { channel = store.state.activeChannel.channel; + // Do not update unread/highlight counters for this channel + // as we are putting this message in the active channel + isActiveChannel = true; + if (data.chan === channel.id) { // If active channel is the intended channel for this message, // remove the showInActive flag