From 2a5518a667ef219e560214cdecd03a45d96aa6b1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 18 Dec 2019 16:38:39 +0100 Subject: Fix lint & tests --- server/models/account/user.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'server/models/account') diff --git a/server/models/account/user.ts b/server/models/account/user.ts index b2cd25bc3..3a339b5c3 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts @@ -583,16 +583,18 @@ export class UserModel extends Model { } canGetVideo (video: MVideoFullLight) { - if (video.privacy === VideoPrivacy.INTERNAL) return true + const videoUserId = video.VideoChannel.Account.userId - if (video.privacy === VideoPrivacy.PRIVATE) { - return video.VideoChannel && video.VideoChannel.Account.userId === this.id + if (video.isBlacklisted()) { + return videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) } - if (video.isBlacklisted()) { - return this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) + if (video.privacy === VideoPrivacy.PRIVATE) { + return video.VideoChannel && videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) } + if (video.privacy === VideoPrivacy.INTERNAL) return true + return false } -- cgit v1.2.3