Remove remaining DOM references to badge/highlight
This commit is contained in:
parent
631fd6138c
commit
0b269423aa
@ -184,7 +184,18 @@ $(function() {
|
||||
channel.channel.unread = 0;
|
||||
}
|
||||
|
||||
if (sidebar.find(".highlight").length === 0) {
|
||||
let hasAnyHighlights = false;
|
||||
|
||||
for (const network of vueApp.networks) {
|
||||
for (const channel of network.channels) {
|
||||
if (channel.highlight > 0) {
|
||||
hasAnyHighlights = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAnyHighlights) {
|
||||
utils.toggleNotificationMarkers(false);
|
||||
}
|
||||
|
||||
@ -290,9 +301,15 @@ $(function() {
|
||||
});
|
||||
|
||||
$(document).on("visibilitychange focus click", () => {
|
||||
if (sidebar.find(".highlight").length === 0) {
|
||||
utils.toggleNotificationMarkers(false);
|
||||
for (const network of vueApp.networks) {
|
||||
for (const channel of network.channels) {
|
||||
if (channel.highlight > 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
utils.toggleNotificationMarkers(false);
|
||||
});
|
||||
|
||||
// Compute how many milliseconds are remaining until the next day starts
|
||||
|
@ -11,6 +11,7 @@ const JoinChannel = require("./join-channel");
|
||||
const helpers_parse = require("./libs/handlebars/parse");
|
||||
const Userlist = require("./userlist");
|
||||
const storage = require("./localStorage");
|
||||
const {vueApp} = require("./vue");
|
||||
|
||||
const chat = $("#chat");
|
||||
const sidebar = $("#sidebar");
|
||||
@ -280,8 +281,14 @@ function renderNetworks(data, singleNetwork) {
|
||||
|
||||
utils.confirmExit();
|
||||
|
||||
if (sidebar.find(".highlight").length) {
|
||||
for (const network of vueApp.networks) {
|
||||
for (const channel of network.channels) {
|
||||
if (channel.highlight > 0) {
|
||||
utils.updateTitle();
|
||||
utils.toggleNotificationMarkers(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ const socket = require("../socket");
|
||||
const render = require("../render");
|
||||
const utils = require("../utils");
|
||||
const options = require("../options");
|
||||
const helpers_roundBadgeNumber = require("../libs/handlebars/roundBadgeNumber");
|
||||
const cleanIrcMessage = require("../libs/handlebars/ircmessageparser/cleanIrcMessage");
|
||||
const webpush = require("../webpush");
|
||||
const chat = $("#chat");
|
||||
@ -34,11 +33,10 @@ function processReceivedMessage(data) {
|
||||
let channelContainer = chat.find(target);
|
||||
let channel = findChannel(data.chan);
|
||||
|
||||
// Clear unread/highlight counter if self-message
|
||||
if (data.msg.self) {
|
||||
channel.channel.highlight = 0;
|
||||
channel.channel.unread = 0;
|
||||
channel.channel.highlight = data.highlight;
|
||||
channel.channel.unread = data.unread;
|
||||
|
||||
if (data.msg.self || data.msg.highlight) {
|
||||
utils.updateTitle();
|
||||
}
|
||||
|
||||
@ -207,18 +205,4 @@ function notifyMessage(targetId, channel, msg) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!serverUnread || button.hasClass("active")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const badge = button.find(".badge")
|
||||
.attr("data-highlight", serverHighlight)
|
||||
.html(helpers_roundBadgeNumber(serverUnread));
|
||||
|
||||
if (msg.highlight) {
|
||||
badge.addClass("highlight");
|
||||
|
||||
utils.updateTitle();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user