aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/shared/video-edit.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-edit/shared/video-edit.component.ts')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts11
1 files changed, 10 insertions, 1 deletions
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 00c7bc41d..b8aef99dd 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
@@ -50,6 +50,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
50 50
51 private schedulerInterval 51 private schedulerInterval
52 private firstPatchDone = false 52 private firstPatchDone = false
53 private initialVideoCaptions: string[] = []
53 54
54 constructor ( 55 constructor (
55 private formValidatorService: FormValidatorService, 56 private formValidatorService: FormValidatorService,
@@ -127,6 +128,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {
127 this.videoLanguages = this.serverService.getVideoLanguages() 128 this.videoLanguages = this.serverService.getVideoLanguages()
128 129
129 this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute 130 this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute
131
132 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id)
130 } 133 }
131 134
132 ngOnDestroy () { 135 ngOnDestroy () {
@@ -147,7 +150,13 @@ export class VideoEditComponent implements OnInit, OnDestroy {
147 ) 150 )
148 } 151 }
149 152
150 deleteCaption (caption: VideoCaptionEdit) { 153 async deleteCaption (caption: VideoCaptionEdit) {
154 // Caption recovers his former state
155 if (caption.action && this.initialVideoCaptions.indexOf(caption.language.id) !== -1) {
156 caption.action = undefined
157 return
158 }
159
151 // This caption is not on the server, just remove it from our array 160 // This caption is not on the server, just remove it from our array
152 if (caption.action === 'CREATE') { 161 if (caption.action === 'CREATE') {
153 removeElementFromArray(this.videoCaptions, caption) 162 removeElementFromArray(this.videoCaptions, caption)