From cfde28bac33c3644e1b6218eb471b675a37def60 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 9 Jul 2020 15:54:24 +0200 Subject: Add ability to report account --- client/src/app/shared/shared-main/account/actor.model.ts | 6 ++++++ .../shared/shared-main/users/user-notification.model.ts | 10 +++++++++- .../shared-main/users/user-notifications.component.html | 15 ++++++++++++++- 3 files changed, 29 insertions(+), 2 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 9ec6dbab1..bda88bdee 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts @@ -14,6 +14,8 @@ export abstract class Actor implements ActorServer { avatarUrl: string + isLocal: boolean + static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) { if (actor?.avatar?.url) return actor.avatar.url @@ -52,6 +54,10 @@ export abstract class Actor implements ActorServer { this.avatar = hash.avatar + const absoluteAPIUrl = getAbsoluteAPIUrl() + const thisHost = new URL(absoluteAPIUrl).host + this.isLocal = this.host.trim() === thisHost + this.updateComputedAttributes() } 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 a137f8c62..61b48a806 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 @@ -34,7 +34,9 @@ export class UserNotification implements UserNotificationServer { threadId: number video: { + id: number uuid: string + name: string } } @@ -115,13 +117,15 @@ export class UserNotification implements UserNotificationServer { case UserNotificationType.COMMENT_MENTION: if (!this.comment) break this.accountUrl = this.buildAccountUrl(this.comment.account) - this.commentUrl = [ this.buildVideoUrl(this.comment.video), { threadId: this.comment.threadId } ] + this.commentUrl = this.buildCommentUrl(this.comment) break case UserNotificationType.NEW_ABUSE_FOR_MODERATORS: this.abuseUrl = '/admin/moderation/abuses/list' if (this.abuse.video) this.videoUrl = this.buildVideoUrl(this.abuse.video) + else if (this.abuse.comment) this.commentUrl = this.buildCommentUrl(this.abuse.comment) + else if (this.abuse.account) this.accountUrl = this.buildAccountUrl(this.abuse.account) break case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: @@ -190,6 +194,10 @@ export class UserNotification implements UserNotificationServer { return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName } + private buildCommentUrl (comment: { video: { uuid: string }, threadId: number }) { + return [ this.buildVideoUrl(comment.video), { threadId: comment.threadId } ] + } + 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 2b341af2c..8127ae979 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 @@ -45,9 +45,22 @@ -
+ + + + + + + +
+ A new abuse has been created +
-- cgit v1.2.3