diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 19 |
1 files changed, 11 insertions, 8 deletions
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<VideoModel> { | |||
884 | return languageLabel | 884 | return languageLabel |
885 | } | 885 | } |
886 | 886 | ||
887 | private static getPrivacyLabel (id: number) { | ||
888 | let privacyLabel = VIDEO_PRIVACIES[id] | ||
889 | if (!privacyLabel) privacyLabel = 'Unknown' | ||
890 | |||
891 | return privacyLabel | ||
892 | } | ||
893 | |||
887 | getOriginalFile () { | 894 | getOriginalFile () { |
888 | if (Array.isArray(this.VideoFiles) === false) return undefined | 895 | if (Array.isArray(this.VideoFiles) === false) return undefined |
889 | 896 | ||
@@ -990,6 +997,10 @@ export class VideoModel extends Model<VideoModel> { | |||
990 | id: this.language, | 997 | id: this.language, |
991 | label: VideoModel.getLanguageLabel(this.language) | 998 | label: VideoModel.getLanguageLabel(this.language) |
992 | }, | 999 | }, |
1000 | privacy: { | ||
1001 | id: this.privacy, | ||
1002 | label: VideoModel.getPrivacyLabel(this.privacy) | ||
1003 | }, | ||
993 | nsfw: this.nsfw, | 1004 | nsfw: this.nsfw, |
994 | description: this.getTruncatedDescription(), | 1005 | description: this.getTruncatedDescription(), |
995 | isLocal: this.isOwned(), | 1006 | isLocal: this.isOwned(), |
@@ -1016,15 +1027,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1016 | toFormattedDetailsJSON (): VideoDetails { | 1027 | toFormattedDetailsJSON (): VideoDetails { |
1017 | const formattedJson = this.toFormattedJSON() | 1028 | const formattedJson = this.toFormattedJSON() |
1018 | 1029 | ||
1019 | // Maybe our server is not up to date and there are new privacy settings since our version | ||
1020 | let privacyLabel = VIDEO_PRIVACIES[this.privacy] | ||
1021 | if (!privacyLabel) privacyLabel = 'Unknown' | ||
1022 | |||
1023 | const detailsJson = { | 1030 | const detailsJson = { |
1024 | privacy: { | ||
1025 | id: this.privacy, | ||
1026 | label: privacyLabel | ||
1027 | }, | ||
1028 | support: this.support, | 1031 | support: this.support, |
1029 | descriptionPath: this.getDescriptionPath(), | 1032 | descriptionPath: this.getDescriptionPath(), |
1030 | channel: this.VideoChannel.toFormattedJSON(), | 1033 | channel: this.VideoChannel.toFormattedJSON(), |