From 7c027ad41f26407dc9999abbac9bceb6e5d3bf81 Mon Sep 17 00:00:00 2001 From: milan Date: Fri, 15 Mar 2024 10:54:40 +0100 Subject: [PATCH] fix bug where badge disappears on push --- mail/inc/class.mail_ui.inc.php | 8 ++------ mail/js/app.js | 10 ++++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index c1f0cdbf2e..5b685b0d7d 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -4120,16 +4120,12 @@ $filter['before']= date("d-M-Y", $cutoffdate2); if (Mail::$debug) error_log(__METHOD__,' ()'.$e->getMessage ()); continue; } - if (in_array($fS['shortDisplayName'],Mail::$autoFolders)) $fS['shortDisplayName']=lang($fS['shortDisplayName']); //error_log(__METHOD__.__LINE__.array2string($fS)); if ($fS['unseen']) { - $oA[$_folderName] = ['displayName' => $fS['shortDisplayName'], 'unseenCount' => $fS['unseen']]; - } - if ($fS['unseen']==0 && $fS['shortDisplayName']) - { - $oA[$_folderName] = ['displayName' => $fS['shortDisplayName']]; + $oA[$_folderName] = ''.$fS['unseen']; } + } } } diff --git a/mail/js/app.js b/mail/js/app.js index 7a25ebc037..e9dab2e885 100755 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -508,9 +508,7 @@ app.classes.mail = AppJS.extend( if (foldertree && pushData.acl.folder && typeof pushData.acl.unseen !== 'undefined') { let folder_id = {}; - folder_id[folder] = (foldertree.getLabel(folder) || pushData.acl.folder) - .replace(this._unseen_regexp, '')+ - (pushData.acl.unseen ? " ("+pushData.acl.unseen+")" : ''); + folder_id[folder] = pushData.acl.unseen; this.mail_setFolderStatus(folder_id); } @@ -1947,13 +1945,13 @@ app.classes.mail = AppJS.extend( for (const folderId in _status) { //ftree.setLabel(folderId,_status[folderId]["displayName"]); // display folder-name bold for unseen mails - if(_status[folderId]["unseenCount"]) + if(_status[folderId]) { ftree.setStyle(folderId, 'font-weight: bold !important'); - }else if(!_status[folderId]["unseenCount"] || _status[folderId]["unseenCount"] ===0 || _status[folderId]["unseenCount"] ==="0") { + }else if(!_status[folderId] || _status[folderId] ===0 || _status[folderId] ==="0") { ftree.setStyle(folderId, 'font-weight: normal'); } - ftree.set_badge(folderId,_status[folderId]["unseenCount"]); + ftree.set_badge(folderId,_status[folderId]); //alert(i +'->'+_status[i]); } },