Remove showInActive if active network differs

This commit is contained in:
Pavel Djundik 2020-01-05 18:30:56 +02:00
parent 5c64eaf41e
commit e73575a342

View file

@ -29,9 +29,9 @@ socket.on("msg", function(data) {
// Display received notices and errors in currently active channel. // Display received notices and errors in currently active channel.
// Reloading the page will put them back into the lobby window. // Reloading the page will put them back into the lobby window.
if (data.msg.showInActive) {
// We only want to put errors/notices in active channel if they arrive on the same network // We only want to put errors/notices in active channel if they arrive on the same network
if ( if (
data.msg.showInActive &&
store.state.activeChannel && store.state.activeChannel &&
store.state.activeChannel.network === receivingChannel.network store.state.activeChannel.network === receivingChannel.network
) { ) {
@ -40,14 +40,18 @@ socket.on("msg", function(data) {
if (data.chan === channel.id) { if (data.chan === channel.id) {
// If active channel is the intended channel for this message, // If active channel is the intended channel for this message,
// remove the showInActive flag // remove the showInActive flag
data.msg.showInActive = false; delete data.msg.showInActive;
} else { } else {
data.chan = channel.id; data.chan = channel.id;
} }
} else if (!isActiveChannel) { } else {
delete data.msg.showInActive;
}
}
// Do not set unread counter for channel if it is currently active on 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 // It may increase on the server before it processes channel open event from this client
if (!isActiveChannel) {
if (typeof data.highlight !== "undefined") { if (typeof data.highlight !== "undefined") {
channel.highlight = data.highlight; channel.highlight = data.highlight;
} }