aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-05-03 16:16:10 +0200
committerRigel Kent <par@rigelk.eu>2020-05-04 15:01:44 +0200
commit9b1fa49b6032c149d8a848da086f60e52bd4b82a (patch)
tree04495fe9c15e32c85d52f5cc621cb18662101335
parent7f979fd8aa76bd930d601d33b61eae39b8f5d90d (diff)
downloadPeerTube-9b1fa49b6032c149d8a848da086f60e52bd4b82a.tar.gz
PeerTube-9b1fa49b6032c149d8a848da086f60e52bd4b82a.tar.zst
PeerTube-9b1fa49b6032c149d8a848da086f60e52bd4b82a.zip
Support is:blacklisted as video-abuse-list filter
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html2
-rw-r--r--server/models/video/video-abuse.ts15
2 files changed, 11 insertions, 6 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 cf5cd58f8..bf989cb4e 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
@@ -24,7 +24,7 @@
24 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:pending' }" class="dropdown-item" i18n>Unsolved reports</a> 24 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:pending' }" class="dropdown-item" i18n>Unsolved reports</a>
25 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:accepted' }" class="dropdown-item" i18n>Accepted reports</a> 25 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:accepted' }" class="dropdown-item" i18n>Accepted reports</a>
26 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:rejected' }" class="dropdown-item" i18n>Refused reports</a> 26 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'state:rejected' }" class="dropdown-item" i18n>Refused reports</a>
27 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'is:blocked' }" class="dropdown-item" i18n>Reports with blocked videos</a> 27 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'is:blacklisted' }" class="dropdown-item" i18n>Reports with blacklisted videos</a>
28 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'is:deleted' }" class="dropdown-item" i18n>Reports with deleted videos</a> 28 <a [routerLink]="[ '/admin/moderation/video-abuses/list' ]" [queryParams]="{ 'search': 'is:deleted' }" class="dropdown-item" i18n>Reports with deleted videos</a>
29 </div> 29 </div>
30 </div> 30 </div>
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index b1f8fed90..f6b546825 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -90,10 +90,13 @@ export enum ScopeNames {
90 }) 90 })
91 } 91 }
92 92
93 if (options.is) { 93 let onlyBlacklisted = false
94 if (options.is === "deleted") {
94 where = Object.assign(where, { 95 where = Object.assign(where, {
95 ...options.is 96 deletedVideo: { [Op.not]: null }
96 }) 97 })
98 } else if (options.is === "blacklisted") {
99 onlyBlacklisted = true
97 } 100 }
98 101
99 return { 102 return {
@@ -184,7 +187,7 @@ export enum ScopeNames {
184 }, 187 },
185 { 188 {
186 model: VideoModel, 189 model: VideoModel,
187 required: false, 190 required: onlyBlacklisted,
188 where: searchAttribute(options.searchVideo, 'name'), 191 where: searchAttribute(options.searchVideo, 'name'),
189 include: [ 192 include: [
190 { 193 {
@@ -202,7 +205,8 @@ export enum ScopeNames {
202 }, 205 },
203 { 206 {
204 attributes: [ 'id', 'reason', 'unfederated' ], 207 attributes: [ 'id', 'reason', 'unfederated' ],
205 model: VideoBlacklistModel 208 model: VideoBlacklistModel,
209 required: onlyBlacklisted
206 } 210 }
207 ] 211 ]
208 } 212 }
@@ -328,7 +332,8 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> {
328 is: { 332 is: {
329 prefix: 'is:', 333 prefix: 'is:',
330 handler: v => { 334 handler: v => {
331 if (v === "deleted") return { deletedVideo: { [Op.not]: null } } 335 if (v === "deleted") return v
336 if (v === "blacklisted") return v
332 return undefined 337 return undefined
333 } 338 }
334 }, 339 },