Verified Commit a3f45a2a authored by Chocobozzz's avatar Chocobozzz
Browse files

Fix default privacy when plugins deleted private

parent de15b052
Pipeline #434094 passed with stages
in 15 minutes and 14 seconds
......@@ -185,6 +185,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
this.serverService.getVideoPrivacies()
.subscribe(privacies => {
this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies
if (this.schedulePublicationPossible) {
this.videoPrivacies.push({
id: this.SPECIAL_SCHEDULED_PRIVACY,
......
......@@ -62,7 +62,7 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
const video: LiveVideoCreate = {
name,
privacy: VideoPrivacy.PRIVATE,
privacy: this.highestPrivacy,
nsfw: this.serverConfig.instance.isNSFW,
waitTranscoding: true,
commentsEnabled: true,
......
......@@ -79,7 +79,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af
this.isImportingVideo = true
const videoUpdate: VideoUpdate = {
privacy: VideoPrivacy.PRIVATE,
privacy: this.highestPrivacy,
waitTranscoding: false,
commentsEnabled: true,
downloadEnabled: true,
......
......@@ -66,7 +66,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
this.isImportingVideo = true
const videoUpdate: VideoUpdate = {
privacy: VideoPrivacy.PRIVATE,
privacy: this.highestPrivacy,
waitTranscoding: false,
commentsEnabled: true,
downloadEnabled: true,
......
......@@ -15,8 +15,8 @@ export abstract class VideoSend extends FormReactive implements OnInit {
videoPrivacies: VideoConstant<VideoPrivacy>[] = []
videoCaptions: VideoCaptionEdit[] = []
firstStepPrivacyId = 0
firstStepChannelId = 0
firstStepPrivacyId: VideoPrivacy
firstStepChannelId: number
abstract firstStepDone: EventEmitter<string>
abstract firstStepError: EventEmitter<void>
......@@ -24,11 +24,15 @@ export abstract class VideoSend extends FormReactive implements OnInit {
protected loadingBar: LoadingBarService
protected notifier: Notifier
protected authService: AuthService
protected serverService: ServerService
protected videoService: VideoService
protected videoCaptionService: VideoCaptionService
protected serverConfig: HTMLServerConfig
protected highestPrivacy: VideoPrivacy
abstract canDeactivate (): CanComponentDeactivateResult
ngOnInit () {
......@@ -49,6 +53,8 @@ export abstract class VideoSend extends FormReactive implements OnInit {
this.videoPrivacies = videoPrivacies
this.firstStepPrivacyId = defaultPrivacyId
this.highestPrivacy = this.videoService.getHighestAvailablePrivacy(privacies)
})
}
......
......@@ -265,7 +265,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
downloadEnabled: true,
channelId: this.firstStepChannelId,
nsfw: this.serverConfig.instance.isNSFW,
privacy: VideoPrivacy.PRIVATE.toString(),
privacy: this.highestPrivacy.toString(),
filename: file.name,
previewfile: previewfile as any
}
......
......@@ -404,6 +404,18 @@ export class VideoService implements VideosProvider {
}
}
getHighestAvailablePrivacy (serverPrivacies: VideoConstant<VideoPrivacy>[]) {
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'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment