diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:15:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-08 14:15:16 +0100 |
commit | fe98765624cdd6695739bda719fcb726b71c2b2a (patch) | |
tree | 18b19d427e5c25fc9e5290062f307e668f4c9e45 /server/models | |
parent | ddc07312b041c1c533b68a919681fc9bce83430d (diff) | |
download | PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.gz PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.tar.zst PeerTube-fe98765624cdd6695739bda719fcb726b71c2b2a.zip |
Add ability to skip count query
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video/video.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index e85c5e38e..cd3245ee4 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1284,8 +1284,9 @@ export class VideoModel extends Model<VideoModel> { | |||
1284 | videoPlaylistId?: number, | 1284 | videoPlaylistId?: number, |
1285 | trendingDays?: number, | 1285 | trendingDays?: number, |
1286 | user?: MUserAccountId, | 1286 | user?: MUserAccountId, |
1287 | historyOfUser?: MUserId | 1287 | historyOfUser?: MUserId, |
1288 | }, countVideos = true) { | 1288 | countVideos?: boolean |
1289 | }) { | ||
1289 | if (options.filter && options.filter === 'all-local' && !options.user.hasRight(UserRight.SEE_ALL_VIDEOS)) { | 1290 | if (options.filter && options.filter === 'all-local' && !options.user.hasRight(UserRight.SEE_ALL_VIDEOS)) { |
1290 | throw new Error('Try to filter all-local but no user has not the see all videos right') | 1291 | throw new Error('Try to filter all-local but no user has not the see all videos right') |
1291 | } | 1292 | } |
@@ -1328,7 +1329,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1328 | trendingDays | 1329 | trendingDays |
1329 | } | 1330 | } |
1330 | 1331 | ||
1331 | return VideoModel.getAvailableForApi(query, queryOptions, countVideos) | 1332 | return VideoModel.getAvailableForApi(query, queryOptions, options.countVideos) |
1332 | } | 1333 | } |
1333 | 1334 | ||
1334 | static async searchAndPopulateAccountAndServer (options: { | 1335 | static async searchAndPopulateAccountAndServer (options: { |