Skip to content

Commit

Permalink
Fix new indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximi1970 committed Jul 29, 2024
1 parent edbf5c8 commit 0c6ff13
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions webext/js/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,21 +621,14 @@ const collectUnreadMail = async () => {
SysTrayX.Messaging.accountFilterCheck();
}

//console.debug("collectUnreadMail: folderParam" + JSON.stringify(folderParam));
//console.debug("collectUnreadMail: mailFolderInfo" + JSON.stringify(mailFolderInfo));

if (mailFolderInfo.unreadMessageCount !== undefined) {
if (SysTrayX.Messaging.unread[accountId] === undefined) {
SysTrayX.Messaging.unread[accountId] = {};
}

if (SysTrayX.Messaging.new[accountId] === undefined) {
SysTrayX.Messaging.new[accountId] = {};
}

if (
SysTrayX.Messaging.new[accountId][path] === undefined
) {
SysTrayX.Messaging.new[accountId][path] = [];
}

SysTrayX.Messaging.unread[accountId][path] =
mailFolderInfo.unreadMessageCount;
}
Expand All @@ -645,6 +638,8 @@ const collectUnreadMail = async () => {
SysTrayX.Messaging.new[accountId][path] !== undefined ) {
const messages = SysTrayX.Messaging.new[accountId][path];

//console.debug("collectUnreadMail: new stored" + JSON.stringify(messages));

if (messages.length > 0) {
const newMessages = [];
for (let i = 0; i < messages.length; ++i) {
Expand All @@ -654,8 +649,14 @@ const collectUnreadMail = async () => {
new Promise((res) => res(messenger.messages.get(messageId)));
const header = await getHeaderPromise(message.id);

if (!header.read) {
//console.debug("collectUnreadMail: header" + JSON.stringify(header));

if (header.read === false &&
(header.new === undefined || header.new === true) &&
header.headerMessageId !== "") {
newMessages.push(message);

//console.debug("collectUnreadMail: renew" + JSON.stringify(message));
}
}

Expand Down

0 comments on commit 0c6ff13

Please sign in to comment.