aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/sql
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/sql')
-rw-r--r--server/models/video/sql/videos-id-list-query-builder.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/server/models/video/sql/videos-id-list-query-builder.ts b/server/models/video/sql/videos-id-list-query-builder.ts
index 4a882e790..d825225ab 100644
--- a/server/models/video/sql/videos-id-list-query-builder.ts
+++ b/server/models/video/sql/videos-id-list-query-builder.ts
@@ -40,6 +40,7 @@ export type BuildVideosListQueryOptions = {
40 languageOneOf?: string[] 40 languageOneOf?: string[]
41 tagsOneOf?: string[] 41 tagsOneOf?: string[]
42 tagsAllOf?: string[] 42 tagsAllOf?: string[]
43 privacyOneOf?: VideoPrivacy[]
43 44
44 uuids?: string[] 45 uuids?: string[]
45 46
@@ -138,11 +139,6 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {
138 this.whereStateAvailable() 139 this.whereStateAvailable()
139 } 140 }
140 141
141 // Only list videos with the appropriate priavcy
142 if (!(options.include & VideoInclude.HIDDEN_PRIVACY)) {
143 this.wherePrivacyAvailable(options.user)
144 }
145
146 if (options.videoPlaylistId) { 142 if (options.videoPlaylistId) {
147 this.joinPlaylist(options.videoPlaylistId) 143 this.joinPlaylist(options.videoPlaylistId)
148 } 144 }
@@ -187,6 +183,13 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {
187 this.whereTagsAllOf(options.tagsAllOf) 183 this.whereTagsAllOf(options.tagsAllOf)
188 } 184 }
189 185
186 if (options.privacyOneOf) {
187 this.wherePrivacyOneOf(options.privacyOneOf)
188 } else {
189 // Only list videos with the appropriate priavcy
190 this.wherePrivacyAvailable(options.user)
191 }
192
190 if (options.uuids) { 193 if (options.uuids) {
191 this.whereUUIDs(options.uuids) 194 this.whereUUIDs(options.uuids)
192 } 195 }
@@ -435,6 +438,11 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {
435 ) 438 )
436 } 439 }
437 440
441 private wherePrivacyOneOf (privacyOneOf: VideoPrivacy[]) {
442 this.and.push('"video"."privacy" IN (:privacyOneOf)')
443 this.replacements.privacyOneOf = privacyOneOf
444 }
445
438 private whereUUIDs (uuids: string[]) { 446 private whereUUIDs (uuids: string[]) {
439 this.and.push('"video"."uuid" IN (' + createSafeIn(this.sequelize, uuids) + ')') 447 this.and.push('"video"."uuid" IN (' + createSafeIn(this.sequelize, uuids) + ')')
440 } 448 }