Fix notification settings
This commit is contained in:
parent
431ebbd5e4
commit
f9735a9e88
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<my-input-switch
|
<my-input-switch
|
||||||
|
[inputName]="'web-notification-' + notificationType"
|
||||||
[(ngModel)]="webNotifications[notificationType]"
|
[(ngModel)]="webNotifications[notificationType]"
|
||||||
(ngModelChange)="updateWebSetting(notificationType, webNotifications[notificationType])"
|
(ngModelChange)="updateWebSetting(notificationType, webNotifications[notificationType])"
|
||||||
></my-input-switch>
|
></my-input-switch>
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
|
|
||||||
<div *ngIf="emailEnabled">
|
<div *ngIf="emailEnabled">
|
||||||
<my-input-switch
|
<my-input-switch
|
||||||
|
[inputName]="'email-notification-' + notificationType"
|
||||||
[(ngModel)]="emailNotifications[notificationType]"
|
[(ngModel)]="emailNotifications[notificationType]"
|
||||||
(ngModelChange)="updateEmailSetting(notificationType, emailNotifications[notificationType])"
|
(ngModelChange)="updateEmailSetting(notificationType, emailNotifications[notificationType])"
|
||||||
></my-input-switch>
|
></my-input-switch>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { Subject } from 'rxjs'
|
||||||
import { Component, Input, OnInit } from '@angular/core'
|
import { Component, Input, OnInit } from '@angular/core'
|
||||||
import { Notifier, ServerService, User } from '@app/core'
|
import { Notifier, ServerService, User } from '@app/core'
|
||||||
import { UserNotificationService } from '@app/shared/shared-main'
|
import { UserNotificationService } from '@app/shared/shared-main'
|
||||||
|
import { objectKeysTyped } from '@shared/core-utils'
|
||||||
import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models'
|
import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -141,7 +142,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadNotificationSettings () {
|
private loadNotificationSettings () {
|
||||||
for (const key of Object.keys(this.user.notificationSettings) as (keyof UserNotificationSetting)[]) {
|
for (const key of objectKeysTyped(this.user.notificationSettings)) {
|
||||||
const value = this.user.notificationSettings[key]
|
const value = this.user.notificationSettings[key]
|
||||||
this.emailNotifications[key] = !!(value & UserNotificationSettingValue.EMAIL)
|
this.emailNotifications[key] = !!(value & UserNotificationSettingValue.EMAIL)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[ngbTooltip]="autoPlayNextVideoTooltip" placement="bottom-right auto"
|
[ngbTooltip]="autoPlayNextVideoTooltip" placement="bottom-right auto"
|
||||||
>
|
>
|
||||||
<span i18n>AUTOPLAY</span>
|
<span i18n>AUTOPLAY</span>
|
||||||
<my-input-switch class="small" [(ngModel)]="autoPlayNextVideo" (ngModelChange)="switchAutoPlayNextVideo()"></my-input-switch>
|
<my-input-switch class="small" inputName="autoplay-next-video" [(ngModel)]="autoPlayNextVideo" (ngModelChange)="switchAutoPlayNextVideo()"></my-input-switch>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon>
|
<my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon>
|
||||||
<ng-container i18n>Help share videos</ng-container>
|
<ng-container i18n>Help share videos</ng-container>
|
||||||
|
|
||||||
<my-input-switch class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch>
|
<my-input-switch inputName="p2p-enabled" class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
|
|
|
@ -20,6 +20,7 @@ export class InputSwitchComponent implements ControlValueAccessor {
|
||||||
propagateChange = (_: any) => { /* empty */ }
|
propagateChange = (_: any) => { /* empty */ }
|
||||||
|
|
||||||
writeValue (checked: boolean) {
|
writeValue (checked: boolean) {
|
||||||
|
console.log(checked)
|
||||||
this.checked = checked
|
this.checked = checked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ export class InputSwitchComponent implements ControlValueAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
update () {
|
update () {
|
||||||
|
console.log(this.checked)
|
||||||
this.checked = !this.checked
|
this.checked = !this.checked
|
||||||
this.propagateChange(this.checked)
|
this.propagateChange(this.checked)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue