mirror of https://github.com/Chocobozzz/PeerTube
Fix default privacy when plugins deleted private
parent
de15b052c5
commit
a3f45a2ab3
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue