Skip the notification tab when in maintenance mode
authorAlexander Ebert <ebert@woltlab.com>
Sun, 24 Apr 2022 12:45:58 +0000 (14:45 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 24 Apr 2022 12:45:58 +0000 (14:45 +0200)
See https://www.woltlab.com/community/thread/295237-leeres-benutzermen%C3%BC-im-wartungsmodus/

ts/WoltLabSuite/Core/Ui/Page/Menu/User.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/User.js

index fac3bc955a9384a6d4d9b1f6254a16eb15d13632..c30dc41312ffb91d6d8a6a2e95eb4d3432c3c373 100644 (file)
@@ -115,13 +115,21 @@ export class PageMenuUser implements PageMenuProvider {
       // closed.
       this.openTab(this.activeTab);
     } else {
-      this.openNotifications();
+      if (this.isInMaintenanceMode()) {
+        this.openTab(this.tabs[0]);
+      } else {
+        this.openNotifications();
+      }
     }
 
     this.refreshTabUnreadIndicators();
     this.refreshUnreadIndicator();
   }
 
+  private isInMaintenanceMode(): boolean {
+    return document.body.dataset.application === "wcf" && document.body.dataset.template === "offline";
+  }
+
   private openNotifications(): void {
     const notifications = this.tabs.find((element) => element.dataset.origin === "userNotifications");
     if (!notifications) {
index ef4086c7b8991d93edbd5571a53f1c42735acd5c..91c00eeee3e83f2d0033b92ac47abe88e4578183 100644 (file)
@@ -73,11 +73,19 @@ define(["require", "exports", "tslib", "./Container", "../../../Language", "../.
                 this.openTab(this.activeTab);
             }
             else {
-                this.openNotifications();
+                if (this.isInMaintenanceMode()) {
+                    this.openTab(this.tabs[0]);
+                }
+                else {
+                    this.openNotifications();
+                }
             }
             this.refreshTabUnreadIndicators();
             this.refreshUnreadIndicator();
         }
+        isInMaintenanceMode() {
+            return document.body.dataset.application === "wcf" && document.body.dataset.template === "offline";
+        }
         openNotifications() {
             const notifications = this.tabs.find((element) => element.dataset.origin === "userNotifications");
             if (!notifications) {