From 65b21c961c69c4a63c7c0c34be3d6d034a1176c7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Oct 2018 16:43:14 +0200 Subject: Add ability to mute a user/instance by server in client --- server/models/video/video-comment.ts | 4 ++-- server/models/video/video.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'server/models') 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 { static async listThreadsForApi (videoId: number, start: number, count: number, sort: string, user?: UserModel) { const serverActor = await getServerActor() const serverAccountId = serverActor.Account.id - const userAccountId = user.Account.id + const userAccountId = user ? user.Account.id : undefined const query = { offset: start, @@ -330,7 +330,7 @@ export class VideoCommentModel extends Model { static async listThreadCommentsForApi (videoId: number, threadId: number, user?: UserModel) { const serverActor = await getServerActor() const serverAccountId = serverActor.Account.id - const userAccountId = user.Account.id + const userAccountId = user ? user.Account.id : undefined const query = { 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 { // threshold corresponds to how many video the field should have to be returned static async getRandomFieldSamples (field: 'category' | 'channelId', threshold: number, count: number) { - const actorId = (await getServerActor()).id + const serverActor = await getServerActor() + const actorId = serverActor.id - const scopeOptions = { + const scopeOptions: AvailableForListIDsOptions = { + serverAccountId: serverActor.Account.id, actorId, includeLocalVideos: true } -- cgit v1.2.3