From 9b4241e33bf46c4f0468565ce41ca7f810b2dbfa Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Thu, 16 Apr 2020 17:18:55 +0200 Subject: Increase rows per page, add reporter muting for abuse list --- .../instance-account-blocklist.component.html | 2 +- .../instance-server-blocklist.component.html | 2 +- .../+admin/moderation/moderation.component.scss | 4 ++ .../video-abuse-list.component.html | 15 +++--- .../video-abuse-list/video-abuse-list.component.ts | 54 ++++++++++++++++++++-- .../video-blacklist-list.component.html | 2 +- 6 files changed, 66 insertions(+), 13 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html index e40c29abf..6d77c8290 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html @@ -8,7 +8,7 @@ Account - Muted at + Muted at diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html index bf5c00918..075be8498 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html @@ -16,7 +16,7 @@ Instance - Muted at + Muted at diff --git a/client/src/app/+admin/moderation/moderation.component.scss b/client/src/app/+admin/moderation/moderation.component.scss index 9af76d2dd..a015b6d85 100644 --- a/client/src/app/+admin/moderation/moderation.component.scss +++ b/client/src/app/+admin/moderation/moderation.component.scss @@ -29,6 +29,10 @@ } } +.glyphicon-trash { + font-size: 80%; +} + .screenratio { position: relative; width: 100%; diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html index 3d356dc7c..204cb209e 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html @@ -1,15 +1,15 @@ - Reporter - Created + Reporter Video + Created State @@ -40,14 +40,15 @@ - {{ videoAbuse.createdAt }} - + {{ videoAbuse.video.name }} + {{ videoAbuse.createdAt }} + @@ -55,7 +56,7 @@ - + diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 5e48cf24f..9858cbce2 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -15,6 +15,7 @@ import { buildVideoLink, buildVideoEmbed } from 'src/assets/player/utils' import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' import { DomSanitizer } from '@angular/platform-browser' import { BlocklistService } from '@app/shared/blocklist' +import { VideoService } from '@app/shared/video/video.service' @Component({ selector: 'my-video-abuse-list', @@ -26,7 +27,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] totalRecords = 0 - rowsPerPage = 10 + rowsPerPageOptions = [ 20, 50, 100 ] + rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } @@ -36,6 +38,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { private notifier: Notifier, private videoAbuseService: VideoAbuseService, private blocklistService: BlocklistService, + private videoService: VideoService, private videoBlacklistService: VideoBlacklistService, private confirmService: ConfirmService, private i18n: I18n, @@ -78,10 +81,12 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { [ { label: this.i18n('Actions for the video'), - isHeader: true + isHeader: true, + isDisplayed: videoAbuse => !videoAbuse.video.deleted }, { label: this.i18n('Blacklist video'), + isDisplayed: videoAbuse => !videoAbuse.video.deleted, handler: videoAbuse => { this.videoBlacklistService.blacklistVideo(videoAbuse.video.id, undefined, true) .subscribe( @@ -91,6 +96,48 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED) }, + err => this.notifier.error(err.message) + ) + } + }, + { + label: this.i18n('Delete video'), + isDisplayed: videoAbuse => !videoAbuse.video.deleted, + handler: async videoAbuse => { + const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete')) + if (res === false) return + + this.videoService.removeVideo(videoAbuse.video.id) + .subscribe( + () => { + this.notifier.success(this.i18n('Video deleted.')) + + this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED) + }, + + err => this.notifier.error(err.message) + ) + } + } + ], + [ + { + label: this.i18n('Actions for the reporter'), + isHeader: true + }, + { + label: this.i18n('Mute reporter'), + handler: async videoAbuse => { + const account = videoAbuse.reporterAccount as Account + + this.blocklistService.blockAccountByInstance(account) + .subscribe( + () => { + this.notifier.success(this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost })) + + account.mutedByInstance = true + }, + err => this.notifier.error(err.message) ) } @@ -180,7 +227,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { Object.assign(abuse, { reasonHtml: await this.toHtml(abuse.reason), moderationCommentHtml: await this.toHtml(abuse.moderationComment), - embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)) + embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)), + reporterAccount: new Account(abuse.reporterAccount) }) } diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html index 023f4e7b7..2f9fc8ba4 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html @@ -10,7 +10,7 @@ Video Sensitive Unfederated - Date + Date -- cgit v1.2.3