Reset highlights on self messages; update title when other client opens a channel
This commit is contained in:
parent
3e029c4e8a
commit
d00cf72614
@ -97,7 +97,12 @@ function processReceivedMessage(data) {
|
|||||||
|
|
||||||
// Clear unread/highlight counter if self-message
|
// Clear unread/highlight counter if self-message
|
||||||
if (data.msg.self) {
|
if (data.msg.self) {
|
||||||
sidebarTarget.find(".badge").removeClass("highlight").empty();
|
sidebarTarget.find(".badge")
|
||||||
|
.attr("data-highlight", 0)
|
||||||
|
.removeClass("highlight")
|
||||||
|
.empty();
|
||||||
|
|
||||||
|
utils.updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
let messageLimit = 0;
|
let messageLimit = 0;
|
||||||
@ -211,12 +216,12 @@ function notifyMessage(targetId, channel, msg) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const badge = button.find(".badge").html(helpers_roundBadgeNumber(serverUnread));
|
const badge = button.find(".badge")
|
||||||
|
.attr("data-highlight", serverHighlight)
|
||||||
|
.html(helpers_roundBadgeNumber(serverUnread));
|
||||||
|
|
||||||
if (msg.highlight) {
|
if (msg.highlight) {
|
||||||
badge
|
badge.addClass("highlight");
|
||||||
.attr("data-highlight", serverHighlight)
|
|
||||||
.addClass("highlight");
|
|
||||||
|
|
||||||
utils.updateTitle();
|
utils.updateTitle();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const $ = require("jquery");
|
const $ = require("jquery");
|
||||||
const socket = require("../socket");
|
const socket = require("../socket");
|
||||||
|
const utils = require("../utils");
|
||||||
|
|
||||||
// Sync unread badge and marker when other clients open a channel
|
// Sync unread badge and marker when other clients open a channel
|
||||||
socket.on("open", function(id) {
|
socket.on("open", function(id) {
|
||||||
@ -22,6 +23,8 @@ socket.on("open", function(id) {
|
|||||||
.removeClass("highlight")
|
.removeClass("highlight")
|
||||||
.empty();
|
.empty();
|
||||||
|
|
||||||
|
utils.updateTitle();
|
||||||
|
|
||||||
// Move unread marker to the bottom
|
// Move unread marker to the bottom
|
||||||
channel
|
channel
|
||||||
.find(".unread-marker")
|
.find(".unread-marker")
|
||||||
|
Loading…
Reference in New Issue
Block a user