diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-24 17:22:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-24 17:22:40 +0200 |
commit | f9735a9e88ff59dae8c9f6b8a20576ca8a08902b (patch) | |
tree | fca3fe7b02c309616359cb6799396f57029a4f77 /client/src/app/+my-account | |
parent | 431ebbd5e40cdae5326bcd631d9e086cfa4eae1e (diff) | |
download | PeerTube-f9735a9e88ff59dae8c9f6b8a20576ca8a08902b.tar.gz PeerTube-f9735a9e88ff59dae8c9f6b8a20576ca8a08902b.tar.zst PeerTube-f9735a9e88ff59dae8c9f6b8a20576ca8a08902b.zip |
Fix notification settings
Diffstat (limited to 'client/src/app/+my-account')
2 files changed, 4 insertions, 1 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 46f5e5d6b..2af9d576a 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 | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | <div> | 13 | <div> |
14 | <my-input-switch | 14 | <my-input-switch |
15 | [inputName]="'web-notification-' + notificationType" | ||
15 | [(ngModel)]="webNotifications[notificationType]" | 16 | [(ngModel)]="webNotifications[notificationType]" |
16 | (ngModelChange)="updateWebSetting(notificationType, webNotifications[notificationType])" | 17 | (ngModelChange)="updateWebSetting(notificationType, webNotifications[notificationType])" |
17 | ></my-input-switch> | 18 | ></my-input-switch> |
@@ -19,6 +20,7 @@ | |||
19 | 20 | ||
20 | <div *ngIf="emailEnabled"> | 21 | <div *ngIf="emailEnabled"> |
21 | <my-input-switch | 22 | <my-input-switch |
23 | [inputName]="'email-notification-' + notificationType" | ||
22 | [(ngModel)]="emailNotifications[notificationType]" | 24 | [(ngModel)]="emailNotifications[notificationType]" |
23 | (ngModelChange)="updateEmailSetting(notificationType, emailNotifications[notificationType])" | 25 | (ngModelChange)="updateEmailSetting(notificationType, emailNotifications[notificationType])" |
24 | ></my-input-switch> | 26 | ></my-input-switch> |
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 8faba676e..2adc276a9 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 | |||
@@ -3,6 +3,7 @@ import { Subject } from 'rxjs' | |||
3 | import { Component, Input, OnInit } from '@angular/core' | 3 | import { Component, Input, OnInit } from '@angular/core' |
4 | import { Notifier, ServerService, User } from '@app/core' | 4 | import { Notifier, ServerService, User } from '@app/core' |
5 | import { UserNotificationService } from '@app/shared/shared-main' | 5 | import { UserNotificationService } from '@app/shared/shared-main' |
6 | import { objectKeysTyped } from '@shared/core-utils' | ||
6 | import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models' | 7 | import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models' |
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
@@ -141,7 +142,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
141 | } | 142 | } |
142 | 143 | ||
143 | private loadNotificationSettings () { | 144 | private loadNotificationSettings () { |
144 | for (const key of Object.keys(this.user.notificationSettings) as (keyof UserNotificationSetting)[]) { | 145 | for (const key of objectKeysTyped(this.user.notificationSettings)) { |
145 | const value = this.user.notificationSettings[key] | 146 | const value = this.user.notificationSettings[key] |
146 | this.emailNotifications[key] = !!(value & UserNotificationSettingValue.EMAIL) | 147 | this.emailNotifications[key] = !!(value & UserNotificationSettingValue.EMAIL) |
147 | 148 | ||