aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-18 16:38:39 +0100
committerChocobozzz <me@florianbigard.com>2019-12-18 16:47:54 +0100
commit2a5518a667ef219e560214cdecd03a45d96aa6b1 (patch)
tree881d71c1559128015b10e1a79d6fa6eccfe4781a
parent09033f7aa35c32b4d9acb6a92902e4a8f00d5201 (diff)
downloadPeerTube-2a5518a667ef219e560214cdecd03a45d96aa6b1.tar.gz
PeerTube-2a5518a667ef219e560214cdecd03a45d96aa6b1.tar.zst
PeerTube-2a5518a667ef219e560214cdecd03a45d96aa6b1.zip
Fix lint & tests
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts2
-rw-r--r--server/models/account/user.ts12
2 files changed, 8 insertions, 6 deletions
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 {
147 147
148 this.queryParamsSub = this.route.queryParams.subscribe(async queryParams => { 148 this.queryParamsSub = this.route.queryParams.subscribe(async queryParams => {
149 const videoId = queryParams[ 'videoId' ] 149 const videoId = queryParams[ 'videoId' ]
150 if (videoId) await this.loadVideo(videoId) 150 if (videoId) this.loadVideo(videoId)
151 151
152 const start = queryParams[ 'start' ] 152 const start = queryParams[ 'start' ]
153 if (this.player && start) this.player.currentTime(parseInt(start, 10)) 153 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<UserModel> {
583 } 583 }
584 584
585 canGetVideo (video: MVideoFullLight) { 585 canGetVideo (video: MVideoFullLight) {
586 if (video.privacy === VideoPrivacy.INTERNAL) return true 586 const videoUserId = video.VideoChannel.Account.userId
587 587
588 if (video.privacy === VideoPrivacy.PRIVATE) { 588 if (video.isBlacklisted()) {
589 return video.VideoChannel && video.VideoChannel.Account.userId === this.id 589 return videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
590 } 590 }
591 591
592 if (video.isBlacklisted()) { 592 if (video.privacy === VideoPrivacy.PRIVATE) {
593 return this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) 593 return video.VideoChannel && videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
594 } 594 }
595 595
596 if (video.privacy === VideoPrivacy.INTERNAL) return true
597
596 return false 598 return false
597 } 599 }
598 600