aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/moderation/video-abuse-list
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-04-14 10:55:34 +0200
committerRigel Kent <par@rigelk.eu>2020-04-14 15:53:37 +0200
commitbb152476c819e4c7487d080433c616f0d523e049 (patch)
tree955b6afa140b6e83eced3cb21c8ec1d62fa6a15e /client/src/app/+admin/moderation/video-abuse-list
parent1055eb3a7b89bc50dc611ab933f9dbd603488747 (diff)
downloadPeerTube-bb152476c819e4c7487d080433c616f0d523e049.tar.gz
PeerTube-bb152476c819e4c7487d080433c616f0d523e049.tar.zst
PeerTube-bb152476c819e4c7487d080433c616f0d523e049.zip
Refactor follow/mute as modals in admin, add actions in abuse list
Diffstat (limited to 'client/src/app/+admin/moderation/video-abuse-list')
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html4
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts84
2 files changed, 59 insertions, 29 deletions
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 155d10dda..3899ee07f 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
@@ -48,13 +48,13 @@
48 </a> 48 </a>
49 </td> 49 </td>
50 50
51 <td> 51 <td class="c-hand" [pRowToggler]="videoAbuse">
52 <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span> 52 <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span>
53 <span *ngIf="isVideoAbuseRejected(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-remove"></span> 53 <span *ngIf="isVideoAbuseRejected(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-remove"></span>
54 </td> 54 </td>
55 55
56 <td class="action-cell"> 56 <td class="action-cell">
57 <my-action-dropdown placement="bottom-right" i18n-label label="Actions" [actions]="videoAbuseActions" [entry]="videoAbuse"></my-action-dropdown> 57 <my-action-dropdown placement="bottom-right auto" i18n-label label="Actions" [actions]="videoAbuseActions" [entry]="videoAbuse"></my-action-dropdown>
58 </td> 58 </td>
59 </tr> 59 </tr>
60 </ng-template> 60 </ng-template>
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