From b980bcff7b6343d8c9747e735cb55645847e64da Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 12 Jul 2021 14:48:57 +0200 Subject: [PATCH] Fix privacy input altered by plugins --- .../app/shared/shared-main/video/video.service.ts | 12 ++++-------- 1 file 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 { ) } - explainedPrivacyLabels (privacies: VideoConstant[], defaultPrivacyId = VideoPrivacy.PUBLIC) { - const base = [ + explainedPrivacyLabels (serverPrivacies: VideoConstant[], defaultPrivacyId = VideoPrivacy.PUBLIC) { + const descriptions = [ { id: VideoPrivacy.PRIVATE, description: $localize`Only I can see this video` @@ -398,13 +398,9 @@ export class VideoService implements VideosProvider { } ] - const videoPrivacies = base - .filter(o => !!privacies.find(p => p.id === o.id)) // filter down to privacies that where in the input - .map(o => ({ ...privacies[o.id - 1], ...o })) // merge the input privacies that contain a label, and extend them with a description - return { - defaultPrivacyId: videoPrivacies.find(p => p.id === defaultPrivacyId)?.id || videoPrivacies[0].id, - videoPrivacies + defaultPrivacyId: serverPrivacies.find(p => p.id === defaultPrivacyId)?.id || serverPrivacies[0].id, + videoPrivacies: serverPrivacies.map(p => ({ ...p, description: descriptions.find(p => p.id).description })) } } -- 2.41.0