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()
|
this.serverService.getVideoPrivacies()
|
||||||
.subscribe(privacies => {
|
.subscribe(privacies => {
|
||||||
this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies
|
this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies
|
||||||
|
|
||||||
if (this.schedulePublicationPossible) {
|
if (this.schedulePublicationPossible) {
|
||||||
this.videoPrivacies.push({
|
this.videoPrivacies.push({
|
||||||
id: this.SPECIAL_SCHEDULED_PRIVACY,
|
id: this.SPECIAL_SCHEDULED_PRIVACY,
|
||||||
|
|
|
@ -62,7 +62,7 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
|
||||||
|
|
||||||
const video: LiveVideoCreate = {
|
const video: LiveVideoCreate = {
|
||||||
name,
|
name,
|
||||||
privacy: VideoPrivacy.PRIVATE,
|
privacy: this.highestPrivacy,
|
||||||
nsfw: this.serverConfig.instance.isNSFW,
|
nsfw: this.serverConfig.instance.isNSFW,
|
||||||
waitTranscoding: true,
|
waitTranscoding: true,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af
|
||||||
this.isImportingVideo = true
|
this.isImportingVideo = true
|
||||||
|
|
||||||
const videoUpdate: VideoUpdate = {
|
const videoUpdate: VideoUpdate = {
|
||||||
privacy: VideoPrivacy.PRIVATE,
|
privacy: this.highestPrivacy,
|
||||||
waitTranscoding: false,
|
waitTranscoding: false,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
|
|
|
@ -66,7 +66,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
|
||||||
this.isImportingVideo = true
|
this.isImportingVideo = true
|
||||||
|
|
||||||
const videoUpdate: VideoUpdate = {
|
const videoUpdate: VideoUpdate = {
|
||||||
privacy: VideoPrivacy.PRIVATE,
|
privacy: this.highestPrivacy,
|
||||||
waitTranscoding: false,
|
waitTranscoding: false,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
|
|
|
@ -15,8 +15,8 @@ export abstract class VideoSend extends FormReactive implements OnInit {
|
||||||
videoPrivacies: VideoConstant<VideoPrivacy>[] = []
|
videoPrivacies: VideoConstant<VideoPrivacy>[] = []
|
||||||
videoCaptions: VideoCaptionEdit[] = []
|
videoCaptions: VideoCaptionEdit[] = []
|
||||||
|
|
||||||
firstStepPrivacyId = 0
|
firstStepPrivacyId: VideoPrivacy
|
||||||
firstStepChannelId = 0
|
firstStepChannelId: number
|
||||||
|
|
||||||
abstract firstStepDone: EventEmitter<string>
|
abstract firstStepDone: EventEmitter<string>
|
||||||
abstract firstStepError: EventEmitter<void>
|
abstract firstStepError: EventEmitter<void>
|
||||||
|
@ -24,11 +24,15 @@ export abstract class VideoSend extends FormReactive implements OnInit {
|
||||||
protected loadingBar: LoadingBarService
|
protected loadingBar: LoadingBarService
|
||||||
protected notifier: Notifier
|
protected notifier: Notifier
|
||||||
protected authService: AuthService
|
protected authService: AuthService
|
||||||
|
|
||||||
protected serverService: ServerService
|
protected serverService: ServerService
|
||||||
protected videoService: VideoService
|
protected videoService: VideoService
|
||||||
protected videoCaptionService: VideoCaptionService
|
protected videoCaptionService: VideoCaptionService
|
||||||
|
|
||||||
protected serverConfig: HTMLServerConfig
|
protected serverConfig: HTMLServerConfig
|
||||||
|
|
||||||
|
protected highestPrivacy: VideoPrivacy
|
||||||
|
|
||||||
abstract canDeactivate (): CanComponentDeactivateResult
|
abstract canDeactivate (): CanComponentDeactivateResult
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
|
@ -49,6 +53,8 @@ export abstract class VideoSend extends FormReactive implements OnInit {
|
||||||
|
|
||||||
this.videoPrivacies = videoPrivacies
|
this.videoPrivacies = videoPrivacies
|
||||||
this.firstStepPrivacyId = defaultPrivacyId
|
this.firstStepPrivacyId = defaultPrivacyId
|
||||||
|
|
||||||
|
this.highestPrivacy = this.videoService.getHighestAvailablePrivacy(privacies)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
channelId: this.firstStepChannelId,
|
channelId: this.firstStepChannelId,
|
||||||
nsfw: this.serverConfig.instance.isNSFW,
|
nsfw: this.serverConfig.instance.isNSFW,
|
||||||
privacy: VideoPrivacy.PRIVATE.toString(),
|
privacy: this.highestPrivacy.toString(),
|
||||||
filename: file.name,
|
filename: file.name,
|
||||||
previewfile: previewfile as any
|
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) {
|
nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) {
|
||||||
return nsfwPolicy === 'do_not_list'
|
return nsfwPolicy === 'do_not_list'
|
||||||
? 'false'
|
? 'false'
|
||||||
|
|
Loading…
Reference in New Issue