From 782fe5990e5c9a8fd60e2f353f2ab03c30404fd3 Mon Sep 17 00:00:00 2001 From: Amir Ghezelbash Date: Thu, 13 Aug 2020 15:37:30 +0430 Subject: [PATCH 1/2] runfix: Correctly calculate account unread messages count --- electron/renderer/src/actions/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electron/renderer/src/actions/index.js b/electron/renderer/src/actions/index.js index 4570f1f6cef..22eaa6b8833 100644 --- a/electron/renderer/src/actions/index.js +++ b/electron/renderer/src/actions/index.js @@ -150,7 +150,12 @@ export const updateAccountBadgeCount = (id, count) => { return (dispatch, getState) => { const accounts = getState().accounts; const account = getState().accounts.find(acc => acc.id === id); - const accumulatedCount = accounts.reduce((accumulated, account) => accumulated + account.badgeCount, 0); + const accumulatedCount = accounts.reduce((accumulated, account) => { + if (account.id === id) { + return accumulated + count; + } + return accumulated + account.badgeCount; + }, 0); const ignoreFlash = account.availability === Availability.Type.BUSY; window.sendBadgeCount(accumulatedCount, ignoreFlash); From 75a23a66b46d851a51fafcb05dd279ca4977396f Mon Sep 17 00:00:00 2001 From: Amir Ghezelbash <63250054+thisisamir98@users.noreply.github.com> Date: Thu, 13 Aug 2020 18:44:32 +0430 Subject: [PATCH 2/2] Update electron/renderer/src/actions/index.js Co-authored-by: Florian Imdahl --- electron/renderer/src/actions/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/electron/renderer/src/actions/index.js b/electron/renderer/src/actions/index.js index 22eaa6b8833..b1eb56ec0c6 100644 --- a/electron/renderer/src/actions/index.js +++ b/electron/renderer/src/actions/index.js @@ -151,10 +151,7 @@ export const updateAccountBadgeCount = (id, count) => { const accounts = getState().accounts; const account = getState().accounts.find(acc => acc.id === id); const accumulatedCount = accounts.reduce((accumulated, account) => { - if (account.id === id) { - return accumulated + count; - } - return accumulated + account.badgeCount; + return accumulated + (account.id === id ? count : account.badgeCount); }, 0); const ignoreFlash = account.availability === Availability.Type.BUSY;