diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-12 14:48:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-12 14:48:57 +0200 |
commit | b980bcff7b6343d8c9747e735cb55645847e64da (patch) | |
tree | 2daf02a972cfb7f20a723dd59b4e19106e81e8f2 | |
parent | 3e9cf56480101af06cdeae9dbae04fdcb4973a7f (diff) | |
download | PeerTube-b980bcff7b6343d8c9747e735cb55645847e64da.tar.gz PeerTube-b980bcff7b6343d8c9747e735cb55645847e64da.tar.zst PeerTube-b980bcff7b6343d8c9747e735cb55645847e64da.zip |
Fix privacy input altered by plugins
-rw-r--r-- | client/src/app/shared/shared-main/video/video.service.ts | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index ac640c791..1c1d06291 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -378,8 +378,8 @@ export class VideoService implements VideosProvider { | |||
378 | ) | 378 | ) |
379 | } | 379 | } |
380 | 380 | ||
381 | explainedPrivacyLabels (privacies: VideoConstant<VideoPrivacy>[], defaultPrivacyId = VideoPrivacy.PUBLIC) { | 381 | explainedPrivacyLabels (serverPrivacies: VideoConstant<VideoPrivacy>[], defaultPrivacyId = VideoPrivacy.PUBLIC) { |
382 | const base = [ | 382 | const descriptions = [ |
383 | { | 383 | { |
384 | id: VideoPrivacy.PRIVATE, | 384 | id: VideoPrivacy.PRIVATE, |
385 | description: $localize`Only I can see this video` | 385 | description: $localize`Only I can see this video` |
@@ -398,13 +398,9 @@ export class VideoService implements VideosProvider { | |||
398 | } | 398 | } |
399 | ] | 399 | ] |
400 | 400 | ||
401 | const videoPrivacies = base | ||
402 | .filter(o => !!privacies.find(p => p.id === o.id)) // filter down to privacies that where in the input | ||
403 | .map(o => ({ ...privacies[o.id - 1], ...o })) // merge the input privacies that contain a label, and extend them with a description | ||
404 | |||
405 | return { | 401 | return { |
406 | defaultPrivacyId: videoPrivacies.find(p => p.id === defaultPrivacyId)?.id || videoPrivacies[0].id, | 402 | defaultPrivacyId: serverPrivacies.find(p => p.id === defaultPrivacyId)?.id || serverPrivacies[0].id, |
407 | videoPrivacies | 403 | videoPrivacies: serverPrivacies.map(p => ({ ...p, description: descriptions.find(p => p.id).description })) |
408 | } | 404 | } |
409 | } | 405 | } |
410 | 406 | ||