From 7b250b58b0d4bfea51aa076489cdbda6039837b9 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 30 Jun 2022 15:55:24 +0200 Subject: [PATCH] Use the `null` value to indicate a missing identifier --- ts/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.ts | 8 ++++---- ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts | 4 ++-- ts/WoltLabSuite/Core/Ui/Page/Menu/Main/Provider.ts | 2 +- .../js/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.js | 8 ++++---- .../files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ts/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.ts b/ts/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.ts index d7268e4964..bb010448ab 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.ts @@ -20,7 +20,7 @@ function getSubMenuItems(subMenu: HTMLElement, menuItem: string): MenuItem[] { children, counter: 0, depth: 1, - identifier: false, + identifier: null, title, }; }); @@ -40,7 +40,7 @@ function getMenuItems(category: HTMLOListElement): MenuItem[] { children, counter: 0, depth: 2, - identifier: false, + identifier: null, link: link.href, title: link.textContent!, }; @@ -59,7 +59,7 @@ function getMenuItemActions(link: HTMLAnchorElement): MenuItem[] { children: [], counter: 0, depth: 2, - identifier: false, + identifier: null, link: action.href, title: action.dataset.tooltip || action.title, }; @@ -82,7 +82,7 @@ export class AcpUiPageMenuMainBackend implements PageMenuMainProvider { children, counter: 0, depth: 0, - identifier: false, + identifier: null, title, }; }, diff --git a/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts b/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts index d803b10fbd..91178d4e97 100644 --- a/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts +++ b/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts @@ -221,7 +221,7 @@ export class PageMenuMain implements PageMenuProvider { counter.setAttribute("aria-hidden", "true"); counter.textContent = menuItem.counter.toString(); - if (menuItem.identifier !== false) { + if (menuItem.identifier !== null) { this.menuItemBadges.set(menuItem.identifier, counter); } @@ -325,7 +325,7 @@ export class PageMenuMain implements PageMenuProvider { } private refreshUnreadBage(menuItem: MenuItem): void { - if (menuItem.identifier !== false) { + if (menuItem.identifier !== null) { const counter = this.menuItemBadges.get(menuItem.identifier); if (counter) { if (menuItem.counter === 0) { diff --git a/ts/WoltLabSuite/Core/Ui/Page/Menu/Main/Provider.ts b/ts/WoltLabSuite/Core/Ui/Page/Menu/Main/Provider.ts index 96b1535158..bf29542225 100644 --- a/ts/WoltLabSuite/Core/Ui/Page/Menu/Main/Provider.ts +++ b/ts/WoltLabSuite/Core/Ui/Page/Menu/Main/Provider.ts @@ -16,7 +16,7 @@ export type MenuItem = { children: MenuItem[]; counter: number; depth: MenuItemDepth; - identifier: string | false; + identifier: string | null; link?: string; title: string; }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.js index 1fcc63ac03..4536af7e5f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Page/Menu/Main/Backend.js @@ -20,7 +20,7 @@ define(["require", "exports"], function (require, exports) { children, counter: 0, depth: 1, - identifier: false, + identifier: null, title, }; }); @@ -37,7 +37,7 @@ define(["require", "exports"], function (require, exports) { children, counter: 0, depth: 2, - identifier: false, + identifier: null, link: link.href, title: link.textContent, }; @@ -54,7 +54,7 @@ define(["require", "exports"], function (require, exports) { children: [], counter: 0, depth: 2, - identifier: false, + identifier: null, link: action.href, title: action.dataset.tooltip || action.title, }; @@ -73,7 +73,7 @@ define(["require", "exports"], function (require, exports) { children, counter: 0, depth: 0, - identifier: false, + identifier: null, title, }; }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js index a1d2ebfc0e..a803706fec 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js @@ -168,7 +168,7 @@ define(["require", "exports", "tslib", "./Container", "../../../Language", "../. counter.classList.add("pageMenuMainItemCounter", "badge", "badgeUpdate"); counter.setAttribute("aria-hidden", "true"); counter.textContent = menuItem.counter.toString(); - if (menuItem.identifier !== false) { + if (menuItem.identifier !== null) { this.menuItemBadges.set(menuItem.identifier, counter); } link.append(counter); @@ -253,7 +253,7 @@ define(["require", "exports", "tslib", "./Container", "../../../Language", "../. menuItems.forEach((menuItem) => this.refreshUnreadBage(menuItem)); } refreshUnreadBage(menuItem) { - if (menuItem.identifier !== false) { + if (menuItem.identifier !== null) { const counter = this.menuItemBadges.get(menuItem.identifier); if (counter) { if (menuItem.counter === 0) { -- 2.20.1