aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index d216ed47d..e6a8d3f95 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -972,7 +972,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
972 }) { 972 }) {
973 const { accountId, channelId, start, count, sort, search, isLive } = options 973 const { accountId, channelId, start, count, sort, search, isLive } = options
974 974
975 function buildBaseQuery (): FindOptions { 975 function buildBaseQuery (forCount: boolean): FindOptions {
976 const where: WhereOptions = {} 976 const where: WhereOptions = {}
977 977
978 if (search) { 978 if (search) {
@@ -1001,7 +1001,9 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1001 where: channelWhere, 1001 where: channelWhere,
1002 include: [ 1002 include: [
1003 { 1003 {
1004 model: AccountModel, 1004 model: forCount
1005 ? AccountModel.unscoped()
1006 : AccountModel,
1005 where: { 1007 where: {
1006 id: accountId 1008 id: accountId
1007 }, 1009 },
@@ -1015,8 +1017,8 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1015 return baseQuery 1017 return baseQuery
1016 } 1018 }
1017 1019
1018 const countQuery = buildBaseQuery() 1020 const countQuery = buildBaseQuery(true)
1019 const findQuery = buildBaseQuery() 1021 const findQuery = buildBaseQuery(false)
1020 1022
1021 const findScopes: (string | ScopeOptions)[] = [ 1023 const findScopes: (string | ScopeOptions)[] = [
1022 ScopeNames.WITH_SCHEDULED_UPDATE, 1024 ScopeNames.WITH_SCHEDULED_UPDATE,