diff options
Diffstat (limited to 'server/models/video/sql/videos-model-list-query-builder.ts')
-rw-r--r-- | server/models/video/sql/videos-model-list-query-builder.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/server/models/video/sql/videos-model-list-query-builder.ts b/server/models/video/sql/videos-model-list-query-builder.ts index e61c51de8..ef92bd2b0 100644 --- a/server/models/video/sql/videos-model-list-query-builder.ts +++ b/server/models/video/sql/videos-model-list-query-builder.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { VideoInclude } from '@shared/models' | ||
1 | import { Sequelize } from 'sequelize' | 2 | import { Sequelize } from 'sequelize' |
2 | import { AbstractVideosModelQueryBuilder } from './shared/abstract-videos-model-query-builder' | 3 | import { AbstractVideosModelQueryBuilder } from './shared/abstract-videos-model-query-builder' |
3 | import { VideoModelBuilder } from './shared/video-model-builder' | 4 | import { VideoModelBuilder } from './shared/video-model-builder' |
@@ -28,7 +29,7 @@ export class VideosModelListQueryBuilder extends AbstractVideosModelQueryBuilder | |||
28 | this.buildListQueryFromIdsQuery(options) | 29 | this.buildListQueryFromIdsQuery(options) |
29 | 30 | ||
30 | return this.runQuery() | 31 | return this.runQuery() |
31 | .then(rows => this.videoModelBuilder.buildVideosFromRows(rows)) | 32 | .then(rows => this.videoModelBuilder.buildVideosFromRows({ rows, include: options.include })) |
32 | } | 33 | } |
33 | 34 | ||
34 | private buildInnerQuery (options: BuildVideosListQueryOptions) { | 35 | private buildInnerQuery (options: BuildVideosListQueryOptions) { |
@@ -64,6 +65,14 @@ export class VideosModelListQueryBuilder extends AbstractVideosModelQueryBuilder | |||
64 | this.includePlaylist(options.videoPlaylistId) | 65 | this.includePlaylist(options.videoPlaylistId) |
65 | } | 66 | } |
66 | 67 | ||
68 | if (options.include & VideoInclude.BLACKLISTED) { | ||
69 | this.includeBlacklisted() | ||
70 | } | ||
71 | |||
72 | if (options.include & VideoInclude.BLOCKED_OWNER) { | ||
73 | this.includeBlockedOwnerAndServer(options.serverAccountIdForBlock, options.user) | ||
74 | } | ||
75 | |||
67 | const select = this.buildSelect() | 76 | const select = this.buildSelect() |
68 | 77 | ||
69 | this.query = `${select} FROM (${this.innerQuery}) AS "tmp" ${this.joins} ${this.innerSort}` | 78 | this.query = `${select} FROM (${this.innerQuery}) AS "tmp" ${this.joins} ${this.innerSort}` |