From ee6263a0063328ac4b72f1f606a6d73eb549ada5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 16 Nov 2021 22:47:54 +0100 Subject: [PATCH] MOBILE-3914 menu: Fix more badge calculation --- src/core/features/mainmenu/pages/menu/menu.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/features/mainmenu/pages/menu/menu.ts b/src/core/features/mainmenu/pages/menu/menu.ts index 63799d858..465352809 100644 --- a/src/core/features/mainmenu/pages/menu/menu.ts +++ b/src/core/features/mainmenu/pages/menu/menu.ts @@ -183,8 +183,13 @@ export class CoreMainMenuPage implements OnInit, OnDestroy { return; } - const numItems = CoreMainMenu.getNumItems(); - this.moreBadge = this.allHandlers.some((handler, index) => (handler.onlyInMore || index >= numItems) && !!handler.badge); + // Calculate the main handlers not to display them in this view. + const mainHandlers = this.allHandlers + .filter((handler) => !handler.onlyInMore) + .slice(0, CoreMainMenu.getNumItems()); + + // Use only the handlers that don't appear in the main view. + this.moreBadge = this.allHandlers.some((handler) => mainHandlers.indexOf(handler) == -1 && !!handler.badge); } /**