mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-13 00:18:15 +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() {
|
function resetMentionsCount() {
|
||||||
|
if (!twister.mentions.lengthNew)
|
||||||
|
return;
|
||||||
|
|
||||||
twister.mentions.lengthNew = 0;
|
twister.mentions.lengthNew = 0;
|
||||||
|
|
||||||
for (var j in twister.mentions.twists.cached)
|
for (var j in twister.mentions.twists.cached)
|
||||||
@ -420,30 +423,47 @@ function getNewGroupDMsCount() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetNewDMsCount() {
|
function resetNewDMsCount() {
|
||||||
|
var isNewDetected;
|
||||||
|
|
||||||
for (var peerAlias in twister.DMs)
|
for (var peerAlias in twister.DMs)
|
||||||
if (peerAlias[0] !== '*') {
|
if (twister.DMs[peerAlias].lengthNew && peerAlias[0] !== '*') {
|
||||||
twister.DMs[peerAlias].lengthNew = 0;
|
twister.DMs[peerAlias].lengthNew = 0;
|
||||||
for (var j in twister.DMs[peerAlias].twists.cached)
|
for (var j in twister.DMs[peerAlias].twists.cached)
|
||||||
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
||||||
|
|
||||||
|
isNewDetected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isNewDetected)
|
||||||
|
return;
|
||||||
|
|
||||||
saveDMsToStorage();
|
saveDMsToStorage();
|
||||||
$.MAL.updateNewDMsUI(getNewDMsCount());
|
$.MAL.updateNewDMsUI(getNewDMsCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetNewDMsCountGroup() {
|
function resetNewDMsCountGroup() {
|
||||||
|
var isNewDetected;
|
||||||
|
|
||||||
for (var peerAlias in twister.DMs)
|
for (var peerAlias in twister.DMs)
|
||||||
if (peerAlias[0] === '*') {
|
if (twister.DMs[peerAlias].lengthNew && peerAlias[0] === '*') {
|
||||||
twister.DMs[peerAlias].lengthNew = 0;
|
twister.DMs[peerAlias].lengthNew = 0;
|
||||||
for (var j in twister.DMs[peerAlias].twists.cached)
|
for (var j in twister.DMs[peerAlias].twists.cached)
|
||||||
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
||||||
|
|
||||||
|
isNewDetected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isNewDetected)
|
||||||
|
return;
|
||||||
|
|
||||||
saveDMsToStorage();
|
saveDMsToStorage();
|
||||||
$.MAL.updateNewGroupDMsUI(getNewGroupDMsCount());
|
$.MAL.updateNewGroupDMsUI(getNewGroupDMsCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetNewDMsCountForPeer(peerAlias) {
|
function resetNewDMsCountForPeer(peerAlias) {
|
||||||
|
if (!twister.DMs[peerAlias].lengthNew)
|
||||||
|
return;
|
||||||
|
|
||||||
twister.DMs[peerAlias].lengthNew = 0;
|
twister.DMs[peerAlias].lengthNew = 0;
|
||||||
for (var j in twister.DMs[peerAlias].twists.cached)
|
for (var j in twister.DMs[peerAlias].twists.cached)
|
||||||
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
delete twister.DMs[peerAlias].twists.cached[j].isNew;
|
||||||
|
Loading…
Reference in New Issue
Block a user