From c7ac8450b71c4b317ee9498335dac06a52d04775 Mon Sep 17 00:00:00 2001 From: kaffem <29717789+kaffem@users.noreply.github.com> Date: Thu, 20 Aug 2020 16:14:07 +0200 Subject: [PATCH] added login checks before retrieving notification count --- enhancements/notifications.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/enhancements/notifications.js b/enhancements/notifications.js index c3db45e..e91f6e5 100644 --- a/enhancements/notifications.js +++ b/enhancements/notifications.js @@ -1,6 +1,7 @@ let __notificationCount = ''; runAfterLoad(() => { + retrieveLoginStatus(); __notificationCount = getNotificationCount(); displayNotificationsInTitle(); }, ".*"); @@ -10,8 +11,10 @@ runAfterPathnameChange(() => { }, ".*"); function getNotificationCount() { - let menuUserText = document.getElementById('materialize-menu-dropdown').innerText.split('\n')[4]; - return menuUserText.split(" ")[1] + ' '; + if (isLoggedIn) { + let menuUserText = document.getElementById('materialize-menu-dropdown').innerText.split('\n')[4]; + return menuUserText.split(" ")[1] + ' '; + } } function displayNotificationsInTitle(){