Fix privacy descriptions

This commit is contained in:
Chocobozzz 2021-07-26 14:03:21 +02:00
parent a66424978c
commit d91714ca56
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 15 additions and 19 deletions

View File

@ -379,28 +379,24 @@ export class VideoService implements VideosProvider {
} }
explainedPrivacyLabels (serverPrivacies: VideoConstant<VideoPrivacy>[], defaultPrivacyId = VideoPrivacy.PUBLIC) { explainedPrivacyLabels (serverPrivacies: VideoConstant<VideoPrivacy>[], defaultPrivacyId = VideoPrivacy.PUBLIC) {
const descriptions = [ const descriptions = {
{ [VideoPrivacy.PRIVATE]: $localize`Only I can see this video`,
id: VideoPrivacy.PRIVATE, [VideoPrivacy.UNLISTED]: $localize`Only shareable via a private link`,
description: $localize`Only I can see this video` [VideoPrivacy.PUBLIC]: $localize`Anyone can see this video`,
}, [VideoPrivacy.INTERNAL]: $localize`Only users of this instance can see this video`
{
id: VideoPrivacy.UNLISTED,
description: $localize`Only shareable via a private link`
},
{
id: VideoPrivacy.PUBLIC,
description: $localize`Anyone can see this video`
},
{
id: VideoPrivacy.INTERNAL,
description: $localize`Only users of this instance can see this video`
} }
]
const videoPrivacies = serverPrivacies.map(p => {
return {
...p,
description: descriptions[p.id]
}
})
return { return {
defaultPrivacyId: serverPrivacies.find(p => p.id === defaultPrivacyId)?.id || serverPrivacies[0].id, videoPrivacies,
videoPrivacies: serverPrivacies.map(p => ({ ...p, description: descriptions.find(p => p.id).description })) defaultPrivacyId: serverPrivacies.find(p => p.id === defaultPrivacyId)?.id || serverPrivacies[0].id
} }
} }