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({
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 = [
{
'newCommentOnMyVideo',
'blacklistOnMyVideo',
'myVideoPublished',
- 'myVideoImportFinished'
+ 'myVideoImportFinished',
+ 'myVideoStudioEditionFinished'
]
},
}
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)
}
}
}