From 22a73cb879a5cc775d4bec3d72fa9c9cf52e5175 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 12 Dec 2019 15:47:47 +0100 Subject: Add internal privacy mode --- .../video/modals/video-download.component.ts | 2 +- client/src/app/shared/video/video.service.ts | 30 ++++++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'client/src') diff --git a/client/src/app/shared/video/modals/video-download.component.ts b/client/src/app/shared/video/modals/video-download.component.ts index 5849ee458..712740086 100644 --- a/client/src/app/shared/video/modals/video-download.component.ts +++ b/client/src/app/shared/video/modals/video-download.component.ts @@ -59,7 +59,7 @@ export class VideoDownloadComponent { return } - const suffix = this.video.privacy.id === VideoPrivacy.PRIVATE + const suffix = this.video.privacy.id === VideoPrivacy.PRIVATE || this.video.privacy.id === VideoPrivacy.INTERNAL ? '?access_token=' + this.auth.getAccessToken() : '' diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 45366e3e3..b0fa55966 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts @@ -332,18 +332,26 @@ export class VideoService implements VideosProvider { } explainedPrivacyLabels (privacies: VideoConstant[]) { - const newPrivacies = privacies.slice() - - const privatePrivacy = newPrivacies.find(p => p.id === VideoPrivacy.PRIVATE) - if (privatePrivacy) privatePrivacy.label = this.i18n('Only I can see this video') - - const unlistedPrivacy = newPrivacies.find(p => p.id === VideoPrivacy.UNLISTED) - if (unlistedPrivacy) unlistedPrivacy.label = this.i18n('Only people with the private link can see this video') - - const publicPrivacy = newPrivacies.find(p => p.id === VideoPrivacy.PUBLIC) - if (publicPrivacy) publicPrivacy.label = this.i18n('Anyone can see this video') + const base = [ + { + id: VideoPrivacy.PRIVATE, + label: this.i18n('Only I can see this video') + }, + { + id: VideoPrivacy.UNLISTED, + label: this.i18n('Only people with the private link can see this video') + }, + { + id: VideoPrivacy.PUBLIC, + label: this.i18n('Anyone can see this video') + }, + { + id: VideoPrivacy.INTERNAL, + label: this.i18n('Only users of this instance can see this video') + } + ] - return privacies + return base.filter(o => !!privacies.find(p => p.id === o.id)) } private setVideoRate (id: number, rateType: UserVideoRateType) { -- cgit v1.2.3