aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-comment.ts4
-rw-r--r--server/models/video/video.ts6
2 files changed, 6 insertions, 4 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 08c6b3ff0..dd6d08139 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -294,7 +294,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
294 static async listThreadsForApi (videoId: number, start: number, count: number, sort: string, user?: UserModel) { 294 static async listThreadsForApi (videoId: number, start: number, count: number, sort: string, user?: UserModel) {
295 const serverActor = await getServerActor() 295 const serverActor = await getServerActor()
296 const serverAccountId = serverActor.Account.id 296 const serverAccountId = serverActor.Account.id
297 const userAccountId = user.Account.id 297 const userAccountId = user ? user.Account.id : undefined
298 298
299 const query = { 299 const query = {
300 offset: start, 300 offset: start,
@@ -330,7 +330,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
330 static async listThreadCommentsForApi (videoId: number, threadId: number, user?: UserModel) { 330 static async listThreadCommentsForApi (videoId: number, threadId: number, user?: UserModel) {
331 const serverActor = await getServerActor() 331 const serverActor = await getServerActor()
332 const serverAccountId = serverActor.Account.id 332 const serverAccountId = serverActor.Account.id
333 const userAccountId = user.Account.id 333 const userAccountId = user ? user.Account.id : undefined
334 334
335 const query = { 335 const query = {
336 order: [ [ 'createdAt', 'ASC' ], [ 'updatedAt', 'ASC' ] ], 336 order: [ [ 'createdAt', 'ASC' ], [ 'updatedAt', 'ASC' ] ],
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index eab99cba7..6c183933b 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1255,9 +1255,11 @@ export class VideoModel extends Model<VideoModel> {
1255 1255
1256 // threshold corresponds to how many video the field should have to be returned 1256 // threshold corresponds to how many video the field should have to be returned
1257 static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) { 1257 static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) {
1258 const actorId = (await getServerActor()).id 1258 const serverActor = await getServerActor()
1259 const actorId = serverActor.id
1259 1260
1260 const scopeOptions = { 1261 const scopeOptions: AvailableForListIDsOptions = {
1262 serverAccountId: serverActor.Account.id,
1261 actorId, 1263 actorId,
1262 includeLocalVideos: true 1264 includeLocalVideos: true
1263 } 1265 }