From a3f45a2ab3cadf0946f06a0539993b828becd516 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Jul 2021 08:46:51 +0200 Subject: Fix default privacy when plugins deleted private --- client/src/app/shared/shared-main/video/video.service.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'client/src/app/shared') 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 1c1d06291..49d6fc1c7 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -404,6 +404,18 @@ export class VideoService implements VideosProvider { } } + getHighestAvailablePrivacy (serverPrivacies: VideoConstant[]) { + const order = [ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL, VideoPrivacy.UNLISTED, VideoPrivacy.PUBLIC ] + + for (const privacy of order) { + if (serverPrivacies.find(p => p.id === privacy)) { + return privacy + } + } + + throw new Error('No highest privacy available') + } + nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) { return nsfwPolicy === 'do_not_list' ? 'false' -- cgit v1.2.3