aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 08:46:51 +0200
committerChocobozzz <me@florianbigard.com>2021-07-13 08:46:51 +0200
commita3f45a2ab3cadf0946f06a0539993b828becd516 (patch)
tree6ebd8e6f1fe199e71ac7a6c9e0b6f161dff9fd97
parentde15b052c59cbd4b99bca835b124485ca1af399e (diff)
downloadPeerTube-a3f45a2ab3cadf0946f06a0539993b828becd516.tar.gz
PeerTube-a3f45a2ab3cadf0946f06a0539993b828becd516.tar.zst
PeerTube-a3f45a2ab3cadf0946f06a0539993b828becd516.zip
Fix default privacy when plugins deleted private
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.ts1
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-send.ts10
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts2
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts12
7 files changed, 25 insertions, 6 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
index aebd53318..90a0e8f52 100644
--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
@@ -185,6 +185,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
185 this.serverService.getVideoPrivacies() 185 this.serverService.getVideoPrivacies()
186 .subscribe(privacies => { 186 .subscribe(privacies => {
187 this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies 187 this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies
188
188 if (this.schedulePublicationPossible) { 189 if (this.schedulePublicationPossible) {
189 this.videoPrivacies.push({ 190 this.videoPrivacies.push({
190 id: this.SPECIAL_SCHEDULED_PRIVACY, 191 id: this.SPECIAL_SCHEDULED_PRIVACY,
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts
index 01c9fcb16..db25dc6be 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts
@@ -62,7 +62,7 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
62 62
63 const video: LiveVideoCreate = { 63 const video: LiveVideoCreate = {
64 name, 64 name,
65 privacy: VideoPrivacy.PRIVATE, 65 privacy: this.highestPrivacy,
66 nsfw: this.serverConfig.instance.isNSFW, 66 nsfw: this.serverConfig.instance.isNSFW,
67 waitTranscoding: true, 67 waitTranscoding: true,
68 commentsEnabled: true, 68 commentsEnabled: true,
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts
index 172dd5ba5..62aaeb019 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts
@@ -79,7 +79,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af
79 this.isImportingVideo = true 79 this.isImportingVideo = true
80 80
81 const videoUpdate: VideoUpdate = { 81 const videoUpdate: VideoUpdate = {
82 privacy: VideoPrivacy.PRIVATE, 82 privacy: this.highestPrivacy,
83 waitTranscoding: false, 83 waitTranscoding: false,
84 commentsEnabled: true, 84 commentsEnabled: true,
85 downloadEnabled: true, 85 downloadEnabled: true,
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts
index 2994d05fa..3243b4d38 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts
@@ -66,7 +66,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
66 this.isImportingVideo = true 66 this.isImportingVideo = true
67 67
68 const videoUpdate: VideoUpdate = { 68 const videoUpdate: VideoUpdate = {
69 privacy: VideoPrivacy.PRIVATE, 69 privacy: this.highestPrivacy,
70 waitTranscoding: false, 70 waitTranscoding: false,
71 commentsEnabled: true, 71 commentsEnabled: true,
72 downloadEnabled: true, 72 downloadEnabled: true,
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
index 0e7a26a47..ce8de049d 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
@@ -15,8 +15,8 @@ export abstract class VideoSend extends FormReactive implements OnInit {
15 videoPrivacies: VideoConstant<VideoPrivacy>[] = [] 15 videoPrivacies: VideoConstant<VideoPrivacy>[] = []
16 videoCaptions: VideoCaptionEdit[] = [] 16 videoCaptions: VideoCaptionEdit[] = []
17 17
18 firstStepPrivacyId = 0 18 firstStepPrivacyId: VideoPrivacy
19 firstStepChannelId = 0 19 firstStepChannelId: number
20 20
21 abstract firstStepDone: EventEmitter<string> 21 abstract firstStepDone: EventEmitter<string>
22 abstract firstStepError: EventEmitter<void> 22 abstract firstStepError: EventEmitter<void>
@@ -24,11 +24,15 @@ export abstract class VideoSend extends FormReactive implements OnInit {
24 protected loadingBar: LoadingBarService 24 protected loadingBar: LoadingBarService
25 protected notifier: Notifier 25 protected notifier: Notifier
26 protected authService: AuthService 26 protected authService: AuthService
27
27 protected serverService: ServerService 28 protected serverService: ServerService
28 protected videoService: VideoService 29 protected videoService: VideoService
29 protected videoCaptionService: VideoCaptionService 30 protected videoCaptionService: VideoCaptionService
31
30 protected serverConfig: HTMLServerConfig 32 protected serverConfig: HTMLServerConfig
31 33
34 protected highestPrivacy: VideoPrivacy
35
32 abstract canDeactivate (): CanComponentDeactivateResult 36 abstract canDeactivate (): CanComponentDeactivateResult
33 37
34 ngOnInit () { 38 ngOnInit () {
@@ -49,6 +53,8 @@ export abstract class VideoSend extends FormReactive implements OnInit {
49 53
50 this.videoPrivacies = videoPrivacies 54 this.videoPrivacies = videoPrivacies
51 this.firstStepPrivacyId = defaultPrivacyId 55 this.firstStepPrivacyId = defaultPrivacyId
56
57 this.highestPrivacy = this.videoService.getHighestAvailablePrivacy(privacies)
52 }) 58 })
53 } 59 }
54 60
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
index ec027f257..627de33c0 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
@@ -265,7 +265,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
265 downloadEnabled: true, 265 downloadEnabled: true,
266 channelId: this.firstStepChannelId, 266 channelId: this.firstStepChannelId,
267 nsfw: this.serverConfig.instance.isNSFW, 267 nsfw: this.serverConfig.instance.isNSFW,
268 privacy: VideoPrivacy.PRIVATE.toString(), 268 privacy: this.highestPrivacy.toString(),
269 filename: file.name, 269 filename: file.name,
270 previewfile: previewfile as any 270 previewfile: previewfile as any
271 } 271 }
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 {
404 } 404 }
405 } 405 }
406 406
407 getHighestAvailablePrivacy (serverPrivacies: VideoConstant<VideoPrivacy>[]) {
408 const order = [ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL, VideoPrivacy.UNLISTED, VideoPrivacy.PUBLIC ]
409
410 for (const privacy of order) {
411 if (serverPrivacies.find(p => p.id === privacy)) {
412 return privacy
413 }
414 }
415
416 throw new Error('No highest privacy available')
417 }
418
407 nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) { 419 nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) {
408 return nsfwPolicy === 'do_not_list' 420 return nsfwPolicy === 'do_not_list'
409 ? 'false' 421 ? 'false'