aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-12 10:43:50 +0200
committerChocobozzz <me@florianbigard.com>2022-08-12 10:43:50 +0200
commit2f6e1730026b089cb18842a6996d50b928de440c (patch)
treee3a858185ee11adc6d8ada34a21c52441586c236 /client/src/app/+videos/+video-edit
parent9a3f72508cfac5264230bcb42492b10e714a1f2c (diff)
downloadPeerTube-2f6e1730026b089cb18842a6996d50b928de440c.tar.gz
PeerTube-2f6e1730026b089cb18842a6996d50b928de440c.tar.zst
PeerTube-2f6e1730026b089cb18842a6996d50b928de440c.zip
Prevent creating multiple lives
Diffstat (limited to 'client/src/app/+videos/+video-edit')
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts9
2 files changed, 10 insertions, 1 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html
index f537b939f..2fb29303f 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html
@@ -61,7 +61,7 @@
61 <div class="submit-container"> 61 <div class="submit-container">
62 <my-button className="orange-button" i18n-label label="Update" icon="circle-tick" 62 <my-button className="orange-button" i18n-label label="Update" icon="circle-tick"
63 (click)="updateSecondStep()" 63 (click)="updateSecondStep()"
64 [disabled]="!form.valid" 64 [disabled]="!form.valid || isUpdatingVideo === true"
65 ></my-button> 65 ></my-button>
66 </div> 66 </div>
67</form> 67</form>
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
27 firstStepPermanentLive: boolean 27 firstStepPermanentLive: boolean
28 28
29 isInUpdateForm = false 29 isInUpdateForm = false
30 isUpdatingVideo = false
31 isOrHasGoingLive = false
30 32
31 liveVideo: LiveVideo 33 liveVideo: LiveVideo
32 34
@@ -64,6 +66,9 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
64 } 66 }
65 67
66 goLive () { 68 goLive () {
69 if (this.isOrHasGoingLive) return
70 this.isOrHasGoingLive = true
71
67 const name = 'Live' 72 const name = 'Live'
68 73
69 const video: LiveVideoCreate = { 74 const video: LiveVideoCreate = {
@@ -115,6 +120,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
115 async updateSecondStep () { 120 async updateSecondStep () {
116 if (!await this.isFormValid()) return 121 if (!await this.isFormValid()) return
117 122
123 this.isUpdatingVideo = true
124
118 const video = new VideoEdit() 125 const video = new VideoEdit()
119 video.patch(this.form.value) 126 video.patch(this.form.value)
120 video.id = this.videoId 127 video.id = this.videoId
@@ -134,6 +141,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView
134 this.liveVideoService.updateLive(this.videoId, liveVideoUpdate) 141 this.liveVideoService.updateLive(this.videoId, liveVideoUpdate)
135 ]).subscribe({ 142 ]).subscribe({
136 next: () => { 143 next: () => {
144 this.isUpdatingVideo = false
145
137 this.notifier.success($localize`Live published.`) 146 this.notifier.success($localize`Live published.`)
138 147
139 this.router.navigateByUrl(Video.buildWatchUrl(video)) 148 this.router.navigateByUrl(Video.buildWatchUrl(video))