From 3cf68b869decf07ff7435fe1436d4f3134df1bf4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Dec 2021 17:17:01 +0100 Subject: Ability for admins to set default upload values --- .../app/+videos/+video-edit/shared/video-edit.component.ts | 9 +++++---- .../video-add-components/video-go-live.component.ts | 2 -- .../video-add-components/video-import-torrent.component.ts | 2 -- .../video-add-components/video-import-url.component.ts | 2 -- .../+videos/+video-edit/video-add-components/video-send.ts | 4 +++- .../video-add-components/video-upload.component.ts | 2 -- .../shared/action-buttons/action-buttons.component.html | 2 +- .../shared/action-buttons/action-buttons.component.scss | 3 ++- .../shared/metadata/video-attributes.component.html | 14 +++++++------- 9 files changed, 18 insertions(+), 22 deletions(-) (limited to 'client/src/app') 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 39767f258..2bec933e9 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 @@ -110,9 +110,10 @@ export class VideoEditComponent implements OnInit, OnDestroy { updateForm () { const defaultValues: any = { nsfw: 'false', - commentsEnabled: 'true', - downloadEnabled: 'true', + commentsEnabled: this.serverConfig.defaults.publish.commentsEnabled, + downloadEnabled: this.serverConfig.defaults.publish.downloadEnabled, waitTranscoding: 'true', + licence: this.serverConfig.defaults.publish.licence, tags: [] } const obj: any = { @@ -160,6 +161,8 @@ export class VideoEditComponent implements OnInit, OnDestroy { } ngOnInit () { + this.serverConfig = this.serverService.getHTMLConfig() + this.updateForm() this.pluginService.ensurePluginsAreLoaded('video-edit') @@ -200,8 +203,6 @@ export class VideoEditComponent implements OnInit, OnDestroy { } }) - this.serverConfig = this.serverService.getHTMLConfig() - this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) this.ngZone.runOutsideAngular(() => { 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 01eabb0d7..46a7ebb0b 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 @@ -70,8 +70,6 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView privacy: this.highestPrivacy, nsfw: this.serverConfig.instance.isNSFW, waitTranscoding: true, - commentsEnabled: true, - downloadEnabled: true, permanentLive: this.firstStepPermanentLive, saveReplay: this.firstStepPermanentLive === false && this.isReplayAllowed(), channelId: this.firstStepChannelId 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 87e47683f..5e758910e 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 @@ -81,8 +81,6 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af const videoUpdate: VideoUpdate = { privacy: this.highestPrivacy, waitTranscoding: false, - commentsEnabled: true, - downloadEnabled: true, channelId: this.firstStepChannelId } 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 3487c1adf..2ea70ed55 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 @@ -68,8 +68,6 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV const videoUpdate: VideoUpdate = { privacy: this.highestPrivacy, waitTranscoding: false, - commentsEnabled: true, - downloadEnabled: true, channelId: this.firstStepChannelId } 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 efa8c85a3..5e086ef42 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 @@ -49,7 +49,9 @@ export abstract class VideoSend extends FormReactive implements OnInit { this.serverService.getVideoPrivacies() .subscribe( privacies => { - const { videoPrivacies, defaultPrivacyId } = this.videoService.explainedPrivacyLabels(privacies) + const defaultPrivacy = this.serverConfig.defaults.publish.privacy + + const { videoPrivacies, defaultPrivacyId } = this.videoService.explainedPrivacyLabels(privacies, defaultPrivacy) this.videoPrivacies = videoPrivacies this.firstStepPrivacyId = defaultPrivacyId 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 28d7ec458..76f154249 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 @@ -277,8 +277,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy private uploadFile (file: File, previewfile?: File) { const metadata = { waitTranscoding: true, - commentsEnabled: true, - downloadEnabled: true, channelId: this.firstStepChannelId, nsfw: this.serverConfig.instance.isNSFW, privacy: this.highestPrivacy.toString(), diff --git a/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.html b/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.html index 8fb244cc4..f23efca98 100644 --- a/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.html +++ b/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.html @@ -36,7 +36,7 @@