aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-01 16:05:30 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-10 14:02:41 +0200
commitd95d15598847c7f020aa056e7e6e0c02d2bbf732 (patch)
treea8a593f1269688caf9e5f99559996f346290fec5 /client/src/app/shared/shared-main
parent72493e44e9b455a04c4f093ed6c6ffa300b98d8b (diff)
downloadPeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.tar.gz
PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.tar.zst
PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.zip
Use 3 tables to represent abuses
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/account/actor.model.ts2
-rw-r--r--client/src/app/shared/shared-main/users/user-notification.model.ts26
-rw-r--r--client/src/app/shared/shared-main/users/user-notifications.component.html8
3 files changed, 24 insertions, 12 deletions
diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts
index 5fc7989dd..0fa161ce6 100644
--- a/client/src/app/shared/shared-main/account/actor.model.ts
+++ b/client/src/app/shared/shared-main/account/actor.model.ts
@@ -14,7 +14,7 @@ export abstract class Actor implements ActorServer {
14 14
15 avatarUrl: string 15 avatarUrl: string
16 16
17 static GET_ACTOR_AVATAR_URL (actor: { avatar?: Avatar }) { 17 static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) {
18 if (actor?.avatar?.url) return actor.avatar.url 18 if (actor?.avatar?.url) return actor.avatar.url
19 19
20 if (actor && actor.avatar) { 20 if (actor && actor.avatar) {
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 de25d3ab9..389a242fd 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
@@ -25,9 +25,20 @@ export class UserNotification implements UserNotificationServer {
25 video: VideoInfo 25 video: VideoInfo
26 } 26 }
27 27
28 videoAbuse?: { 28 abuse?: {
29 id: number 29 id: number
30 video: VideoInfo 30
31 video?: VideoInfo
32
33 comment?: {
34 threadId: number
35
36 video: {
37 uuid: string
38 }
39 }
40
41 account?: ActorInfo
31 } 42 }
32 43
33 videoBlacklist?: { 44 videoBlacklist?: {
@@ -55,7 +66,7 @@ export class UserNotification implements UserNotificationServer {
55 // Additional fields 66 // Additional fields
56 videoUrl?: string 67 videoUrl?: string
57 commentUrl?: any[] 68 commentUrl?: any[]
58 videoAbuseUrl?: string 69 abuseUrl?: string
59 videoAutoBlacklistUrl?: string 70 videoAutoBlacklistUrl?: string
60 accountUrl?: string 71 accountUrl?: string
61 videoImportIdentifier?: string 72 videoImportIdentifier?: string
@@ -78,7 +89,7 @@ export class UserNotification implements UserNotificationServer {
78 this.comment = hash.comment 89 this.comment = hash.comment
79 if (this.comment) this.setAvatarUrl(this.comment.account) 90 if (this.comment) this.setAvatarUrl(this.comment.account)
80 91
81 this.videoAbuse = hash.videoAbuse 92 this.abuse = hash.abuse
82 93
83 this.videoBlacklist = hash.videoBlacklist 94 this.videoBlacklist = hash.videoBlacklist
84 95
@@ -108,8 +119,9 @@ export class UserNotification implements UserNotificationServer {
108 break 119 break
109 120
110 case UserNotificationType.NEW_VIDEO_ABUSE_FOR_MODERATORS: 121 case UserNotificationType.NEW_VIDEO_ABUSE_FOR_MODERATORS:
111 this.videoAbuseUrl = '/admin/moderation/video-abuses/list' 122 this.abuseUrl = '/admin/moderation/abuses/list'
112 this.videoUrl = this.buildVideoUrl(this.videoAbuse.video) 123
124 if (this.abuse.video) this.videoUrl = this.buildVideoUrl(this.abuse.video)
113 break 125 break
114 126
115 case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: 127 case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS:
@@ -178,7 +190,7 @@ export class UserNotification implements UserNotificationServer {
178 return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName 190 return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName
179 } 191 }
180 192
181 private setAvatarUrl (actor: { avatarUrl?: string, avatar?: Avatar }) { 193 private setAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) {
182 actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor) 194 actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor)
183 } 195 }
184} 196}
diff --git a/client/src/app/shared/shared-main/users/user-notifications.component.html b/client/src/app/shared/shared-main/users/user-notifications.component.html
index d5be1470e..8d31eab0d 100644
--- a/client/src/app/shared/shared-main/users/user-notifications.component.html
+++ b/client/src/app/shared/shared-main/users/user-notifications.component.html
@@ -19,7 +19,7 @@
19 19
20 <ng-template #noVideo> 20 <ng-template #noVideo>
21 <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon> 21 <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon>
22 22
23 <div class="message" i18n> 23 <div class="message" i18n>
24 The notification concerns a video now unavailable 24 The notification concerns a video now unavailable
25 </div> 25 </div>
@@ -46,7 +46,7 @@
46 <my-global-icon iconName="flag" aria-hidden="true"></my-global-icon> 46 <my-global-icon iconName="flag" aria-hidden="true"></my-global-icon>
47 47
48 <div class="message" i18n> 48 <div class="message" i18n>
49 <a (click)="markAsRead(notification)" [routerLink]="notification.videoAbuseUrl">A new video abuse</a> has been created on video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.videoAbuse.video.name }}</a> 49 <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl">A new video abuse</a> has been created on video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.abuse.video.name }}</a>
50 </div> 50 </div>
51 </ng-container> 51 </ng-container>
52 52
@@ -65,7 +65,7 @@
65 <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl"> 65 <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">
66 <img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" /> 66 <img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" />
67 </a> 67 </a>
68 68
69 <div class="message" i18n> 69 <div class="message" i18n>
70 <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> commented your video <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">{{ notification.comment.video.name }}</a> 70 <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> commented your video <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">{{ notification.comment.video.name }}</a>
71 </div> 71 </div>
@@ -73,7 +73,7 @@
73 73
74 <ng-template #noComment> 74 <ng-template #noComment>
75 <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon> 75 <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon>
76 76
77 <div class="message" i18n> 77 <div class="message" i18n>
78 The notification concerns a comment now unavailable 78 The notification concerns a comment now unavailable
79 </div> 79 </div>