Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Do not display empty notification settings group

Chocobozzz098c25ece65f
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 aef5c64ca6..7d84baa117 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 @@
<div *ngIf="webNotifications">
<ng-container *ngFor="let group of notificationSettingGroups">
- <div class="header notification-row">
- <div i18n>{{ group.label }}</div>
- <div i18n>Web</div>
- <div i18n *ngIf="emailEnabled">Email</div>
- </div>
+ <ng-container *ngIf="hasNotificationsInGroup(group)">
+ <div class="header notification-row">
+ <div i18n>{{ group.label }}</div>
+ <div i18n>Web</div>
+ <div i18n *ngIf="emailEnabled">Email</div>
+ </div>
- <ng-container *ngFor="let notificationType of group.keys">
- <div class="small notification-row" *ngIf="hasUserRight(notificationType)">
- <div>{{ labelNotifications[notificationType] }}</div>
+ <ng-container *ngFor="let notificationType of group.keys">
+ <div class="small notification-row" *ngIf="hasUserRight(notificationType)">
+ <div>{{ labelNotifications[notificationType] }}</div>
- <div>
- <my-input-switch
- [label]="getWebLabel(notificationType)"
- [inputName]="'web-notification-' + notificationType"
- [(ngModel)]="webNotifications[notificationType]"
- (ngModelChange)="updateWebSetting(notificationType, webNotifications[notificationType])"
- ></my-input-switch>
- </div>
+ <div>
+ <my-input-switch
+ [label]="getWebLabel(notificationType)"
+ [inputName]="'web-notification-' + notificationType"
+ [(ngModel)]="webNotifications[notificationType]"
+ (ngModelChange)="updateWebSetting(notificationType, webNotifications[notificationType])"
+ ></my-input-switch>
+ </div>
- <div *ngIf="emailEnabled">
- <my-input-switch
- [label]="getEmailLabel(notificationType)"
- [inputName]="'email-notification-' + notificationType"
- [(ngModel)]="emailNotifications[notificationType]"
- (ngModelChange)="updateEmailSetting(notificationType, emailNotifications[notificationType])"
- ></my-input-switch>
+ <div *ngIf="emailEnabled">
+ <my-input-switch
+ [label]="getEmailLabel(notificationType)"
+ [inputName]="'email-notification-' + notificationType"
+ [(ngModel)]="emailNotifications[notificationType]"
+ (ngModelChange)="updateEmailSetting(notificationType, emailNotifications[notificationType])"
+ ></my-input-switch>
+ </div>
</div>
- </div>
+ </ng-container>
</ng-container>
</ng-container>
</div>
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 3e599b42ca..eaa65c9bb6 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]}"`
}