reduceCounter fix for badges in Mail tree v2

This commit is contained in:
milan 2024-03-07 17:35:51 +01:00
parent 8056460464
commit 0260b8723a
2 changed files with 8 additions and 7 deletions

View File

@ -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;
}
/**

View File

@ -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());
}
},