From 0260b8723a145e663763b700105df33204c3c1f9 Mon Sep 17 00:00:00 2001 From: milan Date: Thu, 7 Mar 2024 17:35:51 +0100 Subject: [PATCH] reduceCounter fix for badges in Mail tree v2 --- api/js/etemplate/Et2Tree/Et2Tree.ts | 5 +---- mail/js/app.js | 10 +++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index aa7429cd05..aeecd9471d 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -509,12 +509,9 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) */ setStyle(_id, _style) { - var temp = this.getDomNode(_id).defaultSlot; + const temp = this.getDomNode(_id).defaultSlot; if (!temp) return 0; - if (!temp.style.cssText) temp.setAttribute("style", _style); - else - temp.style.cssText = temp.style.cssText + ";" + _style; } /** diff --git a/mail/js/app.js b/mail/js/app.js index 349dc1dddd..282e3bded2 100755 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1950,7 +1950,7 @@ app.classes.mail = AppJS.extend( if(_status[folderId]["unseenCount"]) { ftree.setStyle(folderId, 'font-weight: bold !important'); - }else { + }else if(!_status[folderId]["unseenCount"] || _status[folderId]["unseenCount"] ===0 || _status[folderId]["unseenCount"] ==="0") { ftree.setStyle(folderId, 'font-weight: normal'); } ftree.set_badge(folderId,_status[folderId]["unseenCount"]); @@ -2177,8 +2177,12 @@ app.classes.mail = AppJS.extend( if (icounter>0) { let newcounter = icounter - 1; - if (newcounter === 0) newcounter = null; - ftree.set_badge(_foldernode.id, newcounter) + if (newcounter === 0) + { + newcounter = null; + ftree.setStyle(_foldernode.id, 'font-weight: normal'); + } + ftree.set_badge(_foldernode.id, newcounter?.toString()); } },