aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts')
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts84
1 files changed, 57 insertions, 27 deletions
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 b135792a7..5e48cf24f 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
@@ -1,9 +1,9 @@
1import { Component, OnInit, ViewChild } from '@angular/core' 1import { Component, OnInit, ViewChild } from '@angular/core'
2import { Account } from '../../../shared/account/account.model' 2import { Account } from '@app/shared/account/account.model'
3import { Notifier } from '@app/core' 3import { Notifier } from '@app/core'
4import { SortMeta } from 'primeng/api' 4import { SortMeta } from 'primeng/api'
5import { VideoAbuse, VideoAbuseState } from '../../../../../../shared' 5import { VideoAbuse, VideoAbuseState } from '../../../../../../shared'
6import { RestPagination, RestTable, VideoAbuseService } from '../../../shared' 6import { RestPagination, RestTable, VideoAbuseService, VideoBlacklistService } from '../../../shared'
7import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
8import { DropdownAction } from '../../../shared/buttons/action-dropdown.component' 8import { DropdownAction } from '../../../shared/buttons/action-dropdown.component'
9import { ConfirmService } from '../../../core/index' 9import { ConfirmService } from '../../../core/index'
@@ -14,6 +14,7 @@ import { Actor } from '@app/shared/actor/actor.model'
14import { buildVideoLink, buildVideoEmbed } from 'src/assets/player/utils' 14import { buildVideoLink, buildVideoEmbed } from 'src/assets/player/utils'
15import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' 15import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
16import { DomSanitizer } from '@angular/platform-browser' 16import { DomSanitizer } from '@angular/platform-browser'
17import { BlocklistService } from '@app/shared/blocklist'
17 18
18@Component({ 19@Component({
19 selector: 'my-video-abuse-list', 20 selector: 'my-video-abuse-list',
@@ -29,11 +30,13 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
29 sort: SortMeta = { field: 'createdAt', order: 1 } 30 sort: SortMeta = { field: 'createdAt', order: 1 }
30 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 31 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
31 32
32 videoAbuseActions: DropdownAction<VideoAbuse>[] = [] 33 videoAbuseActions: DropdownAction<VideoAbuse>[][] = []
33 34
34 constructor ( 35 constructor (
35 private notifier: Notifier, 36 private notifier: Notifier,
36 private videoAbuseService: VideoAbuseService, 37 private videoAbuseService: VideoAbuseService,
38 private blocklistService: BlocklistService,
39 private videoBlacklistService: VideoBlacklistService,
37 private confirmService: ConfirmService, 40 private confirmService: ConfirmService,
38 private i18n: I18n, 41 private i18n: I18n,
39 private markdownRenderer: MarkdownService, 42 private markdownRenderer: MarkdownService,
@@ -42,30 +45,57 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
42 super() 45 super()
43 46
44 this.videoAbuseActions = [ 47 this.videoAbuseActions = [
45 { 48 [
46 label: this.i18n('Delete this report'), 49 {
47 handler: videoAbuse => this.removeVideoAbuse(videoAbuse) 50 label: this.i18n('Internal actions'),
48 }, 51 isHeader: true
49 { 52 },
50 label: this.i18n('Add note'), 53 {
51 handler: videoAbuse => this.openModerationCommentModal(videoAbuse), 54 label: this.i18n('Delete report'),
52 isDisplayed: videoAbuse => !videoAbuse.moderationComment 55 handler: videoAbuse => this.removeVideoAbuse(videoAbuse)
53 }, 56 },
54 { 57 {
55 label: this.i18n('Update note'), 58 label: this.i18n('Add note'),
56 handler: videoAbuse => this.openModerationCommentModal(videoAbuse), 59 handler: videoAbuse => this.openModerationCommentModal(videoAbuse),
57 isDisplayed: videoAbuse => !!videoAbuse.moderationComment 60 isDisplayed: videoAbuse => !videoAbuse.moderationComment
58 }, 61 },
59 { 62 {
60 label: this.i18n('Mark as accepted'), 63 label: this.i18n('Update note'),
61 handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED), 64 handler: videoAbuse => this.openModerationCommentModal(videoAbuse),
62 isDisplayed: videoAbuse => !this.isVideoAbuseAccepted(videoAbuse) 65 isDisplayed: videoAbuse => !!videoAbuse.moderationComment
63 }, 66 },
64 { 67 {
65 label: this.i18n('Mark as rejected'), 68 label: this.i18n('Mark as accepted'),
66 handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.REJECTED), 69 handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED),
67 isDisplayed: videoAbuse => !this.isVideoAbuseRejected(videoAbuse) 70 isDisplayed: videoAbuse => !this.isVideoAbuseAccepted(videoAbuse)
68 } 71 },
72 {
73 label: this.i18n('Mark as rejected'),
74 handler: videoAbuse => this.updateVideoAbuseState(videoAbuse, VideoAbuseState.REJECTED),
75 isDisplayed: videoAbuse => !this.isVideoAbuseRejected(videoAbuse)
76 }
77 ],
78 [
79 {
80 label: this.i18n('Actions for the video'),
81 isHeader: true
82 },
83 {
84 label: this.i18n('Blacklist video'),
85 handler: videoAbuse => {
86 this.videoBlacklistService.blacklistVideo(videoAbuse.video.id, undefined, true)
87 .subscribe(
88 () => {
89 this.notifier.success(this.i18n('Video blacklisted.'))
90
91 this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED)
92 },
93
94 err => this.notifier.error(err.message)
95 )
96 }
97 }
98 ]
69 ] 99 ]
70 } 100 }
71 101