mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-12 16:07:59 +00:00
add check if there's no new mentions or DMs in related reset-save functions
This commit is contained in:
parent
9a97fd0328
commit
366540889c
@ -128,6 +128,9 @@ function queryPendingPushMentions(req, res) {
|
||||
}
|
||||
|
||||
function resetMentionsCount() {
|
||||
if (!twister.mentions.lengthNew)
|
||||
return;
|
||||
|
||||
twister.mentions.lengthNew = 0;
|
||||
|
||||
for (var j in twister.mentions.twists.cached)
|
||||
@ -420,30 +423,47 @@ function getNewGroupDMsCount() {
|
||||
}
|
||||
|
||||
function resetNewDMsCount() {
|
||||
var isNewDetected;
|
||||
|
||||
for (var peerAlias in twister.DMs)
|
||||
if (peerAlias[0] !== '*') {
|
||||
if (twister.DMs[peerAlias].lengthNew && peerAlias[0] !== '*') {
|
||||
twister.DMs[peerAlias].lengthNew = 0;
|
||||
for (var j in twister.DMs[peerAlias].twists.cached)
|
||||
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
||||
|
||||
isNewDetected = true;
|
||||
}
|
||||
|
||||
if (!isNewDetected)
|
||||
return;
|
||||
|
||||
saveDMsToStorage();
|
||||
$.MAL.updateNewDMsUI(getNewDMsCount());
|
||||
}
|
||||
|
||||
function resetNewDMsCountGroup() {
|
||||
var isNewDetected;
|
||||
|
||||
for (var peerAlias in twister.DMs)
|
||||
if (peerAlias[0] === '*') {
|
||||
if (twister.DMs[peerAlias].lengthNew && peerAlias[0] === '*') {
|
||||
twister.DMs[peerAlias].lengthNew = 0;
|
||||
for (var j in twister.DMs[peerAlias].twists.cached)
|
||||
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
||||
|
||||
isNewDetected = true;
|
||||
}
|
||||
|
||||
if (!isNewDetected)
|
||||
return;
|
||||
|
||||
saveDMsToStorage();
|
||||
$.MAL.updateNewGroupDMsUI(getNewGroupDMsCount());
|
||||
}
|
||||
|
||||
function resetNewDMsCountForPeer(peerAlias) {
|
||||
if (!twister.DMs[peerAlias].lengthNew)
|
||||
return;
|
||||
|
||||
twister.DMs[peerAlias].lengthNew = 0;
|
||||
for (var j in twister.DMs[peerAlias].twists.cached)
|
||||
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
||||
|
Loading…
Reference in New Issue
Block a user