From 2243730c8edf210c0a3ffc161bac89785f6a52f0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Apr 2018 14:52:10 +0200 Subject: Add information concerning video privacy in my videos list --- server/models/video/video.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'server/models/video/video.ts') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 2e66f9aa7..c08d18b71 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -884,6 +884,13 @@ export class VideoModel extends Model { return languageLabel } + private static getPrivacyLabel (id: number) { + let privacyLabel = VIDEO_PRIVACIES[id] + if (!privacyLabel) privacyLabel = 'Unknown' + + return privacyLabel + } + getOriginalFile () { if (Array.isArray(this.VideoFiles) === false) return undefined @@ -990,6 +997,10 @@ export class VideoModel extends Model { id: this.language, label: VideoModel.getLanguageLabel(this.language) }, + privacy: { + id: this.privacy, + label: VideoModel.getPrivacyLabel(this.privacy) + }, nsfw: this.nsfw, description: this.getTruncatedDescription(), isLocal: this.isOwned(), @@ -1016,15 +1027,7 @@ export class VideoModel extends Model { toFormattedDetailsJSON (): VideoDetails { const formattedJson = this.toFormattedJSON() - // Maybe our server is not up to date and there are new privacy settings since our version - let privacyLabel = VIDEO_PRIVACIES[this.privacy] - if (!privacyLabel) privacyLabel = 'Unknown' - const detailsJson = { - privacy: { - id: this.privacy, - label: privacyLabel - }, support: this.support, descriptionPath: this.getDescriptionPath(), channel: this.VideoChannel.toFormattedJSON(), -- cgit v1.2.3