diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-05 14:36:05 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-05 14:36:05 +0100 |
commit | 4e74e8032be8293ffe3cb3c30528d4ef7c11a798 (patch) | |
tree | 71e75e137720f2cebc33dbc67076778b77e3db5e /server/models/video | |
parent | ddb83e49ece4e76df1af98aeea30c1d8d133f48c (diff) | |
download | PeerTube-4e74e8032be8293ffe3cb3c30528d4ef7c11a798.tar.gz PeerTube-4e74e8032be8293ffe3cb3c30528d4ef7c11a798.tar.zst PeerTube-4e74e8032be8293ffe3cb3c30528d4ef7c11a798.zip |
Remove inferred type
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index e8cb5aa88..adef37937 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -140,7 +140,7 @@ type ForAPIOptions = { | |||
140 | 140 | ||
141 | type AvailableForListIDsOptions = { | 141 | type AvailableForListIDsOptions = { |
142 | serverAccountId: number | 142 | serverAccountId: number |
143 | actorId: number | 143 | followerActorId: number |
144 | includeLocalVideos: boolean | 144 | includeLocalVideos: boolean |
145 | filter?: VideoFilter | 145 | filter?: VideoFilter |
146 | categoryOneOf?: number[] | 146 | categoryOneOf?: number[] |
@@ -315,7 +315,7 @@ type AvailableForListIDsOptions = { | |||
315 | query.include.push(videoChannelInclude) | 315 | query.include.push(videoChannelInclude) |
316 | } | 316 | } |
317 | 317 | ||
318 | if (options.actorId) { | 318 | if (options.followerActorId) { |
319 | let localVideosReq = '' | 319 | let localVideosReq = '' |
320 | if (options.includeLocalVideos === true) { | 320 | if (options.includeLocalVideos === true) { |
321 | localVideosReq = ' UNION ALL ' + | 321 | localVideosReq = ' UNION ALL ' + |
@@ -327,7 +327,7 @@ type AvailableForListIDsOptions = { | |||
327 | } | 327 | } |
328 | 328 | ||
329 | // Force actorId to be a number to avoid SQL injections | 329 | // Force actorId to be a number to avoid SQL injections |
330 | const actorIdNumber = parseInt(options.actorId.toString(), 10) | 330 | const actorIdNumber = parseInt(options.followerActorId.toString(), 10) |
331 | query.where[ 'id' ][ Sequelize.Op.and ].push({ | 331 | query.where[ 'id' ][ Sequelize.Op.and ].push({ |
332 | [ Sequelize.Op.in ]: Sequelize.literal( | 332 | [ Sequelize.Op.in ]: Sequelize.literal( |
333 | '(' + | 333 | '(' + |
@@ -985,7 +985,7 @@ export class VideoModel extends Model<VideoModel> { | |||
985 | filter?: VideoFilter, | 985 | filter?: VideoFilter, |
986 | accountId?: number, | 986 | accountId?: number, |
987 | videoChannelId?: number, | 987 | videoChannelId?: number, |
988 | actorId?: number | 988 | followerActorId?: number |
989 | trendingDays?: number, | 989 | trendingDays?: number, |
990 | user?: UserModel | 990 | user?: UserModel |
991 | }, countVideos = true) { | 991 | }, countVideos = true) { |
@@ -1008,11 +1008,11 @@ export class VideoModel extends Model<VideoModel> { | |||
1008 | 1008 | ||
1009 | const serverActor = await getServerActor() | 1009 | const serverActor = await getServerActor() |
1010 | 1010 | ||
1011 | // actorId === null has a meaning, so just check undefined | 1011 | // followerActorId === null has a meaning, so just check undefined |
1012 | const actorId = options.actorId !== undefined ? options.actorId : serverActor.id | 1012 | const followerActorId = options.followerActorId !== undefined ? options.followerActorId : serverActor.id |
1013 | 1013 | ||
1014 | const queryOptions = { | 1014 | const queryOptions = { |
1015 | actorId, | 1015 | followerActorId, |
1016 | serverAccountId: serverActor.Account.id, | 1016 | serverAccountId: serverActor.Account.id, |
1017 | nsfw: options.nsfw, | 1017 | nsfw: options.nsfw, |
1018 | categoryOneOf: options.categoryOneOf, | 1018 | categoryOneOf: options.categoryOneOf, |
@@ -1118,7 +1118,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1118 | 1118 | ||
1119 | const serverActor = await getServerActor() | 1119 | const serverActor = await getServerActor() |
1120 | const queryOptions = { | 1120 | const queryOptions = { |
1121 | actorId: serverActor.id, | 1121 | followerActorId: serverActor.id, |
1122 | serverAccountId: serverActor.Account.id, | 1122 | serverAccountId: serverActor.Account.id, |
1123 | includeLocalVideos: options.includeLocalVideos, | 1123 | includeLocalVideos: options.includeLocalVideos, |
1124 | nsfw: options.nsfw, | 1124 | nsfw: options.nsfw, |
@@ -1273,11 +1273,11 @@ export class VideoModel extends Model<VideoModel> { | |||
1273 | // threshold corresponds to how many video the field should have to be returned | 1273 | // threshold corresponds to how many video the field should have to be returned |
1274 | static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) { | 1274 | static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) { |
1275 | const serverActor = await getServerActor() | 1275 | const serverActor = await getServerActor() |
1276 | const actorId = serverActor.id | 1276 | const followerActorId = serverActor.id |
1277 | 1277 | ||
1278 | const scopeOptions: AvailableForListIDsOptions = { | 1278 | const scopeOptions: AvailableForListIDsOptions = { |
1279 | serverAccountId: serverActor.Account.id, | 1279 | serverAccountId: serverActor.Account.id, |
1280 | actorId, | 1280 | followerActorId, |
1281 | includeLocalVideos: true | 1281 | includeLocalVideos: true |
1282 | } | 1282 | } |
1283 | 1283 | ||