diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-26 15:29:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-26 15:29:55 +0100 |
commit | dc4e0ddb742c04bb16a4b921029af263bc240b0e (patch) | |
tree | 307fbb1f826fc4718dc2502fb04c6960adfaf5d7 /client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts | |
parent | 50a66a69a0cde2cc3f9d46acf7fd03f99d275b0c (diff) | |
download | PeerTube-dc4e0ddb742c04bb16a4b921029af263bc240b0e.tar.gz PeerTube-dc4e0ddb742c04bb16a4b921029af263bc240b0e.tar.zst PeerTube-dc4e0ddb742c04bb16a4b921029af263bc240b0e.zip |
Improve notification settings UI
Diffstat (limited to 'client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts | 56 |
1 files changed, 48 insertions, 8 deletions
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 1eac06234..09da979ab 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 | |||
@@ -11,14 +11,14 @@ import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from | |||
11 | styleUrls: [ './my-account-notification-preferences.component.scss' ] | 11 | styleUrls: [ './my-account-notification-preferences.component.scss' ] |
12 | }) | 12 | }) |
13 | export class MyAccountNotificationPreferencesComponent implements OnInit { | 13 | export class MyAccountNotificationPreferencesComponent implements OnInit { |
14 | @Input() user: User = null | 14 | @Input() user: User |
15 | @Input() userInformationLoaded: Subject<any> | 15 | @Input() userInformationLoaded: Subject<any> |
16 | 16 | ||
17 | notificationSettingKeys: (keyof UserNotificationSetting)[] = [] | 17 | notificationSettingGroups: { label: string, keys: (keyof UserNotificationSetting)[] }[] = [] |
18 | emailNotifications: { [ id in keyof UserNotificationSetting ]: boolean } = {} as any | 18 | emailNotifications: { [ id in keyof UserNotificationSetting ]?: boolean } = {} |
19 | webNotifications: { [ id in keyof UserNotificationSetting ]: boolean } = {} as any | 19 | webNotifications: { [ id in keyof UserNotificationSetting ]?: boolean } = {} |
20 | labelNotifications: { [ id in keyof UserNotificationSetting ]: string } = {} as any | 20 | labelNotifications: { [ id in keyof UserNotificationSetting ]?: string } = {} |
21 | rightNotifications: { [ id in keyof Partial<UserNotificationSetting> ]: UserRight } = {} as any | 21 | rightNotifications: { [ id in keyof Partial<UserNotificationSetting> ]?: UserRight } = {} |
22 | emailEnabled = false | 22 | emailEnabled = false |
23 | 23 | ||
24 | private savePreferences = debounce(this.savePreferencesImpl.bind(this), 500) | 24 | private savePreferences = debounce(this.savePreferencesImpl.bind(this), 500) |
@@ -32,7 +32,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
32 | newVideoFromSubscription: $localize`New video from your subscriptions`, | 32 | newVideoFromSubscription: $localize`New video from your subscriptions`, |
33 | newCommentOnMyVideo: $localize`New comment on your video`, | 33 | newCommentOnMyVideo: $localize`New comment on your video`, |
34 | abuseAsModerator: $localize`New abuse`, | 34 | abuseAsModerator: $localize`New abuse`, |
35 | videoAutoBlacklistAsModerator: $localize`Video blocked automatically waiting review`, | 35 | videoAutoBlacklistAsModerator: $localize`An automatically blocked video is awaiting review`, |
36 | blacklistOnMyVideo: $localize`One of your video is blocked/unblocked`, | 36 | blacklistOnMyVideo: $localize`One of your video is blocked/unblocked`, |
37 | myVideoPublished: $localize`Video published (after transcoding/scheduled update)`, | 37 | myVideoPublished: $localize`Video published (after transcoding/scheduled update)`, |
38 | myVideoImportFinished: $localize`Video import finished`, | 38 | myVideoImportFinished: $localize`Video import finished`, |
@@ -46,7 +46,47 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
46 | newPeerTubeVersion: $localize`A new PeerTube version is available`, | 46 | newPeerTubeVersion: $localize`A new PeerTube version is available`, |
47 | newPluginVersion: $localize`One of your plugin/theme has a new available version` | 47 | newPluginVersion: $localize`One of your plugin/theme has a new available version` |
48 | } | 48 | } |
49 | this.notificationSettingKeys = Object.keys(this.labelNotifications) as (keyof UserNotificationSetting)[] | 49 | this.notificationSettingGroups = [ |
50 | { | ||
51 | label: $localize`Social`, | ||
52 | keys: [ | ||
53 | 'newVideoFromSubscription', | ||
54 | 'newFollow', | ||
55 | 'commentMention' | ||
56 | ] | ||
57 | }, | ||
58 | |||
59 | { | ||
60 | label: $localize`Your videos`, | ||
61 | keys: [ | ||
62 | 'newCommentOnMyVideo', | ||
63 | 'blacklistOnMyVideo', | ||
64 | 'myVideoPublished', | ||
65 | 'myVideoImportFinished' | ||
66 | ] | ||
67 | }, | ||
68 | |||
69 | { | ||
70 | label: $localize`Moderation`, | ||
71 | keys: [ | ||
72 | 'abuseStateChange', | ||
73 | 'abuseNewMessage', | ||
74 | 'abuseAsModerator', | ||
75 | 'videoAutoBlacklistAsModerator' | ||
76 | ] | ||
77 | }, | ||
78 | |||
79 | { | ||
80 | label: $localize`Administration`, | ||
81 | keys: [ | ||
82 | 'newUserRegistration', | ||
83 | 'newInstanceFollower', | ||
84 | 'autoInstanceFollowing', | ||
85 | 'newPeerTubeVersion', | ||
86 | 'newPluginVersion' | ||
87 | ] | ||
88 | } | ||
89 | ] | ||
50 | 90 | ||
51 | this.rightNotifications = { | 91 | this.rightNotifications = { |
52 | abuseAsModerator: UserRight.MANAGE_ABUSES, | 92 | abuseAsModerator: UserRight.MANAGE_ABUSES, |