aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-19 14:52:10 +0200
committerChocobozzz <me@florianbigard.com>2018-04-19 14:52:10 +0200
commit2243730c8edf210c0a3ffc161bac89785f6a52f0 (patch)
tree5ff532942876f7828a668399b279e37d80f36ae5 /server/models
parent41f657c570472d0f96aece3234497f83b760dfa0 (diff)
downloadPeerTube-2243730c8edf210c0a3ffc161bac89785f6a52f0.tar.gz
PeerTube-2243730c8edf210c0a3ffc161bac89785f6a52f0.tar.zst
PeerTube-2243730c8edf210c0a3ffc161bac89785f6a52f0.zip
Add information concerning video privacy in my videos list
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video.ts19
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(),