From: Chocobozzz Date: Wed, 18 Dec 2019 15:38:39 +0000 (+0100) Subject: Fix lint & tests X-Git-Tag: v2.1.0-rc.1~167 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=2a5518a667ef219e560214cdecd03a45d96aa6b1;hp=09033f7aa35c32b4d9acb6a92902e4a8f00d5201;p=github%2FChocobozzz%2FPeerTube.git Fix lint & tests --- diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 626d0ca07..835e9e34a 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -147,7 +147,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.queryParamsSub = this.route.queryParams.subscribe(async queryParams => { const videoId = queryParams[ 'videoId' ] - if (videoId) await this.loadVideo(videoId) + if (videoId) this.loadVideo(videoId) const start = queryParams[ 'start' ] if (this.player && start) this.player.currentTime(parseInt(start, 10)) 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 }