From 2f6e1730026b089cb18842a6996d50b928de440c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Aug 2022 10:43:50 +0200 Subject: Prevent creating multiple lives --- .../+video-edit/video-add-components/video-go-live.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts') 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 91eb66931..344b99ea2 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 @@ -27,6 +27,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView firstStepPermanentLive: boolean isInUpdateForm = false + isUpdatingVideo = false + isOrHasGoingLive = false liveVideo: LiveVideo @@ -64,6 +66,9 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView } goLive () { + if (this.isOrHasGoingLive) return + this.isOrHasGoingLive = true + const name = 'Live' const video: LiveVideoCreate = { @@ -115,6 +120,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView async updateSecondStep () { if (!await this.isFormValid()) return + this.isUpdatingVideo = true + const video = new VideoEdit() video.patch(this.form.value) video.id = this.videoId @@ -134,6 +141,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView this.liveVideoService.updateLive(this.videoId, liveVideoUpdate) ]).subscribe({ next: () => { + this.isUpdatingVideo = false + this.notifier.success($localize`Live published.`) this.router.navigateByUrl(Video.buildWatchUrl(video)) -- cgit v1.2.3