From 098c25ece65f1cc842434eb4583244fbbf975153 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Feb 2024 16:30:53 +0100 Subject: [PATCH] Do not display empty notification settings group --- ...nt-notification-preferences.component.html | 56 ++++++++++--------- ...ount-notification-preferences.component.ts | 4 ++ 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html index aef5c64ca..7d84baa11 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html @@ -1,33 +1,35 @@
-
-
{{ group.label }}
-
Web
-
Email
-
- - -
-
{{ labelNotifications[notificationType] }}
- -
- -
- -
- -
+ +
+
{{ group.label }}
+
Web
+
Email
+ + +
+
{{ labelNotifications[notificationType] }}
+ +
+ +
+ +
+ +
+
+
diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts index 3e599b42c..eaa65c9bb 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts @@ -116,6 +116,10 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { return this.user.hasRight(rightToHave) } + hasNotificationsInGroup (group: { keys: (keyof UserNotificationSetting)[] }) { + return group.keys.some(k => this.hasUserRight(k)) + } + getWebLabel (notificationType: keyof UserNotificationSetting) { return `Toggle web notification for "${this.labelNotifications[notificationType]}"` }