aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-24 17:22:40 +0200
committerChocobozzz <me@florianbigard.com>2023-05-24 17:22:40 +0200
commitf9735a9e88ff59dae8c9f6b8a20576ca8a08902b (patch)
treefca3fe7b02c309616359cb6799396f57029a4f77
parent431ebbd5e40cdae5326bcd631d9e086cfa4eae1e (diff)
downloadPeerTube-f9735a9e88ff59dae8c9f6b8a20576ca8a08902b.tar.gz
PeerTube-f9735a9e88ff59dae8c9f6b8a20576ca8a08902b.tar.zst
PeerTube-f9735a9e88ff59dae8c9f6b8a20576ca8a08902b.zip
Fix notification settings
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html2
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts3
-rw-r--r--client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html2
-rw-r--r--client/src/app/menu/menu.component.html2
-rw-r--r--client/src/app/shared/shared-forms/input-switch.component.ts2
5 files changed, 8 insertions, 3 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'
3import { Component, Input, OnInit } from '@angular/core' 3import { Component, Input, OnInit } from '@angular/core'
4import { Notifier, ServerService, User } from '@app/core' 4import { Notifier, ServerService, User } from '@app/core'
5import { UserNotificationService } from '@app/shared/shared-main' 5import { UserNotificationService } from '@app/shared/shared-main'
6import { objectKeysTyped } from '@shared/core-utils'
6import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models' 7import { 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
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html
index 2bbe26c96..59ee57b16 100644
--- a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html
+++ b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.html
@@ -7,7 +7,7 @@
7 [ngbTooltip]="autoPlayNextVideoTooltip" placement="bottom-right auto" 7 [ngbTooltip]="autoPlayNextVideoTooltip" placement="bottom-right auto"
8 > 8 >
9 <span i18n>AUTOPLAY</span> 9 <span i18n>AUTOPLAY</span>
10 <my-input-switch class="small" [(ngModel)]="autoPlayNextVideo" (ngModelChange)="switchAutoPlayNextVideo()"></my-input-switch> 10 <my-input-switch class="small" inputName="autoplay-next-video" [(ngModel)]="autoPlayNextVideo" (ngModelChange)="switchAutoPlayNextVideo()"></my-input-switch>
11 </div> 11 </div>
12 </div> 12 </div>
13 13
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 10b3f15d9..c23bb4f5b 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -61,7 +61,7 @@
61 <my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon> 61 <my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon>
62 <ng-container i18n>Help share videos</ng-container> 62 <ng-container i18n>Help share videos</ng-container>
63 63
64 <my-input-switch class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch> 64 <my-input-switch inputName="p2p-enabled" class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch>
65 </button> 65 </button>
66 66
67 <div class="dropdown-divider"></div> 67 <div class="dropdown-divider"></div>
diff --git a/client/src/app/shared/shared-forms/input-switch.component.ts b/client/src/app/shared/shared-forms/input-switch.component.ts
index abb96de62..f340ce81e 100644
--- a/client/src/app/shared/shared-forms/input-switch.component.ts
+++ b/client/src/app/shared/shared-forms/input-switch.component.ts
@@ -20,6 +20,7 @@ export class InputSwitchComponent implements ControlValueAccessor {
20 propagateChange = (_: any) => { /* empty */ } 20 propagateChange = (_: any) => { /* empty */ }
21 21
22 writeValue (checked: boolean) { 22 writeValue (checked: boolean) {
23 console.log(checked)
23 this.checked = checked 24 this.checked = checked
24 } 25 }
25 26
@@ -32,6 +33,7 @@ export class InputSwitchComponent implements ControlValueAccessor {
32 } 33 }
33 34
34 update () { 35 update () {
36 console.log(this.checked)
35 this.checked = !this.checked 37 this.checked = !this.checked
36 this.propagateChange(this.checked) 38 this.propagateChange(this.checked)
37 } 39 }