diff options
author | Chocobozzz <me@florianbigard.com> | 2020-07-28 09:57:16 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-07-31 11:35:19 +0200 |
commit | d573926e9b94fb19c8f51c53f71fc853182e1761 (patch) | |
tree | 907cc81c7275efe30aa90047c0763a7254bd1063 /client/src/app/shared/shared-main/users/user-notification.model.ts | |
parent | 594d3e48d8a887bbf48ce4cc594c1c36c9640fb1 (diff) | |
download | PeerTube-d573926e9b94fb19c8f51c53f71fc853182e1761.tar.gz PeerTube-d573926e9b94fb19c8f51c53f71fc853182e1761.tar.zst PeerTube-d573926e9b94fb19c8f51c53f71fc853182e1761.zip |
Add migrations for abuse messages
Diffstat (limited to 'client/src/app/shared/shared-main/users/user-notification.model.ts')
-rw-r--r-- | client/src/app/shared/shared-main/users/user-notification.model.ts | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts index 61b48a806..a068daaac 100644 --- a/client/src/app/shared/shared-main/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts | |||
@@ -1,5 +1,14 @@ | |||
1 | import { | ||
2 | AbuseState, | ||
3 | ActorInfo, | ||
4 | FollowState, | ||
5 | UserNotification as UserNotificationServer, | ||
6 | UserNotificationType, | ||
7 | VideoInfo, | ||
8 | UserRight | ||
9 | } from '@shared/models' | ||
1 | import { Actor } from '../account/actor.model' | 10 | import { Actor } from '../account/actor.model' |
2 | import { ActorInfo, Avatar, FollowState, UserNotification as UserNotificationServer, UserNotificationType, VideoInfo } from '@shared/models' | 11 | import { AuthUser } from '@app/core' |
3 | 12 | ||
4 | export class UserNotification implements UserNotificationServer { | 13 | export class UserNotification implements UserNotificationServer { |
5 | id: number | 14 | id: number |
@@ -27,6 +36,7 @@ export class UserNotification implements UserNotificationServer { | |||
27 | 36 | ||
28 | abuse?: { | 37 | abuse?: { |
29 | id: number | 38 | id: number |
39 | state: AbuseState | ||
30 | 40 | ||
31 | video?: VideoInfo | 41 | video?: VideoInfo |
32 | 42 | ||
@@ -69,13 +79,14 @@ export class UserNotification implements UserNotificationServer { | |||
69 | videoUrl?: string | 79 | videoUrl?: string |
70 | commentUrl?: any[] | 80 | commentUrl?: any[] |
71 | abuseUrl?: string | 81 | abuseUrl?: string |
82 | abuseQueryParams?: { [id: string]: string } = {} | ||
72 | videoAutoBlacklistUrl?: string | 83 | videoAutoBlacklistUrl?: string |
73 | accountUrl?: string | 84 | accountUrl?: string |
74 | videoImportIdentifier?: string | 85 | videoImportIdentifier?: string |
75 | videoImportUrl?: string | 86 | videoImportUrl?: string |
76 | instanceFollowUrl?: string | 87 | instanceFollowUrl?: string |
77 | 88 | ||
78 | constructor (hash: UserNotificationServer) { | 89 | constructor (hash: UserNotificationServer, user: AuthUser) { |
79 | this.id = hash.id | 90 | this.id = hash.id |
80 | this.type = hash.type | 91 | this.type = hash.type |
81 | this.read = hash.read | 92 | this.read = hash.read |
@@ -122,12 +133,25 @@ export class UserNotification implements UserNotificationServer { | |||
122 | 133 | ||
123 | case UserNotificationType.NEW_ABUSE_FOR_MODERATORS: | 134 | case UserNotificationType.NEW_ABUSE_FOR_MODERATORS: |
124 | this.abuseUrl = '/admin/moderation/abuses/list' | 135 | this.abuseUrl = '/admin/moderation/abuses/list' |
136 | this.abuseQueryParams.search = '#' + this.abuse.id | ||
125 | 137 | ||
126 | if (this.abuse.video) this.videoUrl = this.buildVideoUrl(this.abuse.video) | 138 | if (this.abuse.video) this.videoUrl = this.buildVideoUrl(this.abuse.video) |
127 | else if (this.abuse.comment) this.commentUrl = this.buildCommentUrl(this.abuse.comment) | 139 | else if (this.abuse.comment) this.commentUrl = this.buildCommentUrl(this.abuse.comment) |
128 | else if (this.abuse.account) this.accountUrl = this.buildAccountUrl(this.abuse.account) | 140 | else if (this.abuse.account) this.accountUrl = this.buildAccountUrl(this.abuse.account) |
129 | break | 141 | break |
130 | 142 | ||
143 | case UserNotificationType.ABUSE_STATE_CHANGE: | ||
144 | this.abuseUrl = '/my-account/abuses' | ||
145 | this.abuseQueryParams.search = '#' + this.abuse.id | ||
146 | break | ||
147 | |||
148 | case UserNotificationType.ABUSE_NEW_MESSAGE: | ||
149 | this.abuseUrl = user.hasRight(UserRight.MANAGE_ABUSES) | ||
150 | ? '/admin/moderation/abuses/list' | ||
151 | : '/my-account/abuses' | ||
152 | this.abuseQueryParams.search = '#' + this.abuse.id | ||
153 | break | ||
154 | |||
131 | case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: | 155 | case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: |
132 | this.videoAutoBlacklistUrl = '/admin/moderation/video-auto-blacklist/list' | 156 | this.videoAutoBlacklistUrl = '/admin/moderation/video-auto-blacklist/list' |
133 | // Backward compatibility where we did not assign videoBlacklist to this type of notification before | 157 | // Backward compatibility where we did not assign videoBlacklist to this type of notification before |