diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-04-17 10:47:22 +0200 |
---|---|---|
committer | Rigel Kent <par@rigelk.eu> | 2020-05-01 16:41:02 +0200 |
commit | 86521a67b2edb06a139b095e489c205457eaba8f (patch) | |
tree | 3a0106ab146c3d8436ce502a43d38838800c4595 /client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | |
parent | 9b4241e33bf46c4f0468565ce41ca7f810b2dbfa (diff) | |
download | PeerTube-86521a67b2edb06a139b095e489c205457eaba8f.tar.gz PeerTube-86521a67b2edb06a139b095e489c205457eaba8f.tar.zst PeerTube-86521a67b2edb06a139b095e489c205457eaba8f.zip |
Add video channel and video thumbnail, rework video appearance in row
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.ts | 49 |
1 files changed, 43 insertions, 6 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 9858cbce2..cc5014ae8 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 | |||
@@ -20,14 +20,14 @@ import { VideoService } from '@app/shared/video/video.service' | |||
20 | @Component({ | 20 | @Component({ |
21 | selector: 'my-video-abuse-list', | 21 | selector: 'my-video-abuse-list', |
22 | templateUrl: './video-abuse-list.component.html', | 22 | templateUrl: './video-abuse-list.component.html', |
23 | styleUrls: [ '../moderation.component.scss'] | 23 | styleUrls: [ '../moderation.component.scss', './video-abuse-list.component.scss' ] |
24 | }) | 24 | }) |
25 | export class VideoAbuseListComponent extends RestTable implements OnInit { | 25 | export class VideoAbuseListComponent extends RestTable implements OnInit { |
26 | @ViewChild('moderationCommentModal', { static: true }) moderationCommentModal: ModerationCommentModalComponent | 26 | @ViewChild('moderationCommentModal', { static: true }) moderationCommentModal: ModerationCommentModalComponent |
27 | 27 | ||
28 | videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] | 28 | videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] |
29 | totalRecords = 0 | 29 | totalRecords = 0 |
30 | rowsPerPageOptions = [ 20, 50, 100 ] | 30 | rowsPerPageOptions = [ 20, 50, 100 ] |
31 | rowsPerPage = this.rowsPerPageOptions[0] | 31 | rowsPerPage = this.rowsPerPageOptions[0] |
32 | sort: SortMeta = { field: 'createdAt', order: 1 } | 32 | sort: SortMeta = { field: 'createdAt', order: 1 } |
33 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 33 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
@@ -86,7 +86,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
86 | }, | 86 | }, |
87 | { | 87 | { |
88 | label: this.i18n('Blacklist video'), | 88 | label: this.i18n('Blacklist video'), |
89 | isDisplayed: videoAbuse => !videoAbuse.video.deleted, | 89 | isDisplayed: videoAbuse => !videoAbuse.video.deleted && !videoAbuse.video.blacklisted, |
90 | handler: videoAbuse => { | 90 | handler: videoAbuse => { |
91 | this.videoBlacklistService.blacklistVideo(videoAbuse.video.id, undefined, true) | 91 | this.videoBlacklistService.blacklistVideo(videoAbuse.video.id, undefined, true) |
92 | .subscribe( | 92 | .subscribe( |
@@ -101,10 +101,29 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
101 | } | 101 | } |
102 | }, | 102 | }, |
103 | { | 103 | { |
104 | label: this.i18n('Unblacklist video'), | ||
105 | isDisplayed: videoAbuse => !videoAbuse.video.deleted && videoAbuse.video.blacklisted, | ||
106 | handler: videoAbuse => { | ||
107 | this.videoBlacklistService.removeVideoFromBlacklist(videoAbuse.video.id) | ||
108 | .subscribe( | ||
109 | () => { | ||
110 | this.notifier.success(this.i18n('Video unblacklisted.')) | ||
111 | |||
112 | this.updateVideoAbuseState(videoAbuse, VideoAbuseState.ACCEPTED) | ||
113 | }, | ||
114 | |||
115 | err => this.notifier.error(err.message) | ||
116 | ) | ||
117 | } | ||
118 | }, | ||
119 | { | ||
104 | label: this.i18n('Delete video'), | 120 | label: this.i18n('Delete video'), |
105 | isDisplayed: videoAbuse => !videoAbuse.video.deleted, | 121 | isDisplayed: videoAbuse => !videoAbuse.video.deleted, |
106 | handler: async videoAbuse => { | 122 | handler: async videoAbuse => { |
107 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete')) | 123 | const res = await this.confirmService.confirm( |
124 | this.i18n('Do you really want to delete this video?'), | ||
125 | this.i18n('Delete') | ||
126 | ) | ||
108 | if (res === false) return | 127 | if (res === false) return |
109 | 128 | ||
110 | this.videoService.removeVideo(videoAbuse.video.id) | 129 | this.videoService.removeVideo(videoAbuse.video.id) |
@@ -126,14 +145,16 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
126 | isHeader: true | 145 | isHeader: true |
127 | }, | 146 | }, |
128 | { | 147 | { |
129 | label: this.i18n('Mute reporter'), | 148 | label: this.i18n('Mute reporter'), |
130 | handler: async videoAbuse => { | 149 | handler: async videoAbuse => { |
131 | const account = videoAbuse.reporterAccount as Account | 150 | const account = videoAbuse.reporterAccount as Account |
132 | 151 | ||
133 | this.blocklistService.blockAccountByInstance(account) | 152 | this.blocklistService.blockAccountByInstance(account) |
134 | .subscribe( | 153 | .subscribe( |
135 | () => { | 154 | () => { |
136 | this.notifier.success(this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost })) | 155 | this.notifier.success( |
156 | this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost }) | ||
157 | ) | ||
137 | 158 | ||
138 | account.mutedByInstance = true | 159 | account.mutedByInstance = true |
139 | }, | 160 | }, |
@@ -141,6 +162,22 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
141 | err => this.notifier.error(err.message) | 162 | err => this.notifier.error(err.message) |
142 | ) | 163 | ) |
143 | } | 164 | } |
165 | }, | ||
166 | { | ||
167 | label: this.i18n('Mute server'), | ||
168 | isDisplayed: videoAbuse => !videoAbuse.reporterAccount.userId, | ||
169 | handler: async videoAbuse => { | ||
170 | this.blocklistService.blockServerByInstance(videoAbuse.reporterAccount.host) | ||
171 | .subscribe( | ||
172 | () => { | ||
173 | this.notifier.success( | ||
174 | this.i18n('Server {{host}} muted by the instance.', { host: videoAbuse.reporterAccount.host }) | ||
175 | ) | ||
176 | }, | ||
177 | |||
178 | err => this.notifier.error(err.message) | ||
179 | ) | ||
180 | } | ||
144 | } | 181 | } |
145 | ] | 182 | ] |
146 | ] | 183 | ] |