]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
Fix notification settings
[github/Chocobozzz/PeerTube.git] / client / src / app / +my-account / my-account-settings / my-account-notification-preferences / my-account-notification-preferences.component.ts
index 09da979ab4d404b4beb909164bd08ae9bcbb635b..2adc276a91f3f8219a3c946a6b7d394b219e9b03 100644 (file)
@@ -3,6 +3,7 @@ import { Subject } from 'rxjs'
 import { Component, Input, OnInit } from '@angular/core'
 import { Notifier, ServerService, User } from '@app/core'
 import { UserNotificationService } from '@app/shared/shared-main'
+import { objectKeysTyped } from '@shared/core-utils'
 import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models'
 
 @Component({
@@ -37,14 +38,15 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
       myVideoPublished: $localize`Video published (after transcoding/scheduled update)`,
       myVideoImportFinished: $localize`Video import finished`,
       newUserRegistration: $localize`A new user registered on your instance`,
-      newFollow: $localize`You or your channel(s) has a new follower`,
+      newFollow: $localize`You or one of your channels has a new follower`,
       commentMention: $localize`Someone mentioned you in video comments`,
       newInstanceFollower: $localize`Your instance has a new follower`,
       autoInstanceFollowing: $localize`Your instance automatically followed another instance`,
       abuseNewMessage: $localize`An abuse report received a new message`,
       abuseStateChange: $localize`One of your abuse reports has been accepted or rejected by moderators`,
       newPeerTubeVersion: $localize`A new PeerTube version is available`,
-      newPluginVersion: $localize`One of your plugin/theme has a new available version`
+      newPluginVersion: $localize`One of your plugin/theme has a new available version`,
+      myVideoStudioEditionFinished: $localize`Video studio edition has finished`
     }
     this.notificationSettingGroups = [
       {
@@ -62,7 +64,8 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
           'newCommentOnMyVideo',
           'blacklistOnMyVideo',
           'myVideoPublished',
-          'myVideoImportFinished'
+          'myVideoImportFinished',
+          'myVideoStudioEditionFinished'
         ]
       },
 
@@ -139,11 +142,11 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
   }
 
   private loadNotificationSettings () {
-    for (const key of Object.keys(this.user.notificationSettings)) {
+    for (const key of objectKeysTyped(this.user.notificationSettings)) {
       const value = this.user.notificationSettings[key]
-      this.emailNotifications[key] = value & UserNotificationSettingValue.EMAIL
+      this.emailNotifications[key] = !!(value & UserNotificationSettingValue.EMAIL)
 
-      this.webNotifications[key] = value & UserNotificationSettingValue.WEB
+      this.webNotifications[key] = !!(value & UserNotificationSettingValue.WEB)
     }
   }
 }