aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-14 09:08:47 +0200
committerChocobozzz <me@florianbigard.com>2018-08-14 09:27:18 +0200
commit191764f30b0a812bf3a9dbdc7daf1d5afe25e12a (patch)
treea5592f8d89949cde832f025e393a3821ad2aca37 /server/models/video/video.ts
parent26b7305a232e547709f433a6edf700bf495935d8 (diff)
downloadPeerTube-191764f30b0a812bf3a9dbdc7daf1d5afe25e12a.tar.gz
PeerTube-191764f30b0a812bf3a9dbdc7daf1d5afe25e12a.tar.zst
PeerTube-191764f30b0a812bf3a9dbdc7daf1d5afe25e12a.zip
Improve blacklist management
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts31
1 files changed, 27 insertions, 4 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index f3a900bc9..b13dee403 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -127,7 +127,8 @@ export enum ScopeNames {
127 WITH_ACCOUNT_DETAILS = 'WITH_ACCOUNT_DETAILS', 127 WITH_ACCOUNT_DETAILS = 'WITH_ACCOUNT_DETAILS',
128 WITH_TAGS = 'WITH_TAGS', 128 WITH_TAGS = 'WITH_TAGS',
129 WITH_FILES = 'WITH_FILES', 129 WITH_FILES = 'WITH_FILES',
130 WITH_SCHEDULED_UPDATE = 'WITH_SCHEDULED_UPDATE' 130 WITH_SCHEDULED_UPDATE = 'WITH_SCHEDULED_UPDATE',
131 WITH_BLACKLISTED = 'WITH_BLACKLISTED'
131} 132}
132 133
133type AvailableForListOptions = { 134type AvailableForListOptions = {
@@ -374,6 +375,15 @@ type AvailableForListOptions = {
374 [ScopeNames.WITH_TAGS]: { 375 [ScopeNames.WITH_TAGS]: {
375 include: [ () => TagModel ] 376 include: [ () => TagModel ]
376 }, 377 },
378 [ScopeNames.WITH_BLACKLISTED]: {
379 include: [
380 {
381 attributes: [ 'id', 'reason' ],
382 model: () => VideoBlacklistModel,
383 required: false
384 }
385 ]
386 },
377 [ScopeNames.WITH_FILES]: { 387 [ScopeNames.WITH_FILES]: {
378 include: [ 388 include: [
379 { 389 {
@@ -1004,7 +1014,13 @@ export class VideoModel extends Model<VideoModel> {
1004 } 1014 }
1005 1015
1006 return VideoModel 1016 return VideoModel
1007 .scope([ ScopeNames.WITH_TAGS, ScopeNames.WITH_FILES, ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_SCHEDULED_UPDATE ]) 1017 .scope([
1018 ScopeNames.WITH_TAGS,
1019 ScopeNames.WITH_BLACKLISTED,
1020 ScopeNames.WITH_FILES,
1021 ScopeNames.WITH_ACCOUNT_DETAILS,
1022 ScopeNames.WITH_SCHEDULED_UPDATE
1023 ])
1008 .findById(id, options) 1024 .findById(id, options)
1009 } 1025 }
1010 1026
@@ -1030,7 +1046,13 @@ export class VideoModel extends Model<VideoModel> {
1030 } 1046 }
1031 1047
1032 return VideoModel 1048 return VideoModel
1033 .scope([ ScopeNames.WITH_TAGS, ScopeNames.WITH_FILES, ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_SCHEDULED_UPDATE ]) 1049 .scope([
1050 ScopeNames.WITH_TAGS,
1051 ScopeNames.WITH_BLACKLISTED,
1052 ScopeNames.WITH_FILES,
1053 ScopeNames.WITH_ACCOUNT_DETAILS,
1054 ScopeNames.WITH_SCHEDULED_UPDATE
1055 ])
1034 .findOne(options) 1056 .findOne(options)
1035 } 1057 }
1036 1058
@@ -1276,7 +1298,8 @@ export class VideoModel extends Model<VideoModel> {
1276 toFormattedDetailsJSON (): VideoDetails { 1298 toFormattedDetailsJSON (): VideoDetails {
1277 const formattedJson = this.toFormattedJSON({ 1299 const formattedJson = this.toFormattedJSON({
1278 additionalAttributes: { 1300 additionalAttributes: {
1279 scheduledUpdate: true 1301 scheduledUpdate: true,
1302 blacklistInfo: true
1280 } 1303 }
1281 }) 1304 })
1282 1305