From d95d15598847c7f020aa056e7e6e0c02d2bbf732 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 1 Jul 2020 16:05:30 +0200 Subject: Use 3 tables to represent abuses --- .../app/shared/shared-main/account/actor.model.ts | 2 +- .../shared-main/users/user-notification.model.ts | 26 ++++++++++++++++------ .../users/user-notifications.component.html | 8 +++---- 3 files changed, 24 insertions(+), 12 deletions(-) (limited to 'client/src/app/shared/shared-main') 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 { avatarUrl: string - static GET_ACTOR_AVATAR_URL (actor: { avatar?: Avatar }) { + static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) { if (actor?.avatar?.url) return actor.avatar.url 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 { video: VideoInfo } - videoAbuse?: { + abuse?: { id: number - video: VideoInfo + + video?: VideoInfo + + comment?: { + threadId: number + + video: { + uuid: string + } + } + + account?: ActorInfo } videoBlacklist?: { @@ -55,7 +66,7 @@ export class UserNotification implements UserNotificationServer { // Additional fields videoUrl?: string commentUrl?: any[] - videoAbuseUrl?: string + abuseUrl?: string videoAutoBlacklistUrl?: string accountUrl?: string videoImportIdentifier?: string @@ -78,7 +89,7 @@ export class UserNotification implements UserNotificationServer { this.comment = hash.comment if (this.comment) this.setAvatarUrl(this.comment.account) - this.videoAbuse = hash.videoAbuse + this.abuse = hash.abuse this.videoBlacklist = hash.videoBlacklist @@ -108,8 +119,9 @@ export class UserNotification implements UserNotificationServer { break case UserNotificationType.NEW_VIDEO_ABUSE_FOR_MODERATORS: - this.videoAbuseUrl = '/admin/moderation/video-abuses/list' - this.videoUrl = this.buildVideoUrl(this.videoAbuse.video) + this.abuseUrl = '/admin/moderation/abuses/list' + + if (this.abuse.video) this.videoUrl = this.buildVideoUrl(this.abuse.video) break case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: @@ -178,7 +190,7 @@ export class UserNotification implements UserNotificationServer { return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName } - private setAvatarUrl (actor: { avatarUrl?: string, avatar?: Avatar }) { + private setAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor) } } 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 @@ - +
The notification concerns a video now unavailable
@@ -46,7 +46,7 @@ @@ -65,7 +65,7 @@ - + @@ -73,7 +73,7 @@ - +
The notification concerns a comment now unavailable
-- cgit v1.2.3