aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts19
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.ts2
-rw-r--r--client/src/app/shared/shared-main/video-caption/video-caption.service.ts4
4 files changed, 9 insertions, 18 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html
index 4543b93d8..be6f676c2 100644
--- a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html
+++ b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html
@@ -17,7 +17,7 @@
17 </textarea> 17 </textarea>
18 18
19 <div *ngIf="formErrors.captionFileContent" class="form-error"> 19 <div *ngIf="formErrors.captionFileContent" class="form-error">
20 {{ formErrors.description }} 20 {{ formErrors.captionFileContent }}
21 </div> 21 </div>
22 </div> 22 </div>
23 23
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts
index d2232a38e..f74f3c5ea 100644
--- a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts
+++ b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts
@@ -1,5 +1,4 @@
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2
3import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators' 2import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 3import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main' 4import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main'
@@ -23,7 +22,6 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
23 22
24 videoCaptionLanguages: VideoConstant<string>[] = [] 23 videoCaptionLanguages: VideoConstant<string>[] = []
25 private openedModal: NgbModalRef 24 private openedModal: NgbModalRef
26 private closingModal = false
27 25
28 constructor ( 26 constructor (
29 protected formValidatorService: FormValidatorService, 27 protected formValidatorService: FormValidatorService,
@@ -44,25 +42,21 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
44 42
45 loadCaptionContent () { 43 loadCaptionContent () {
46 const { captionPath } = this.videoCaption 44 const { captionPath } = this.videoCaption
47 if (captionPath) { 45 if (!captionPath) return
48 this.videoCaptionService.getCaptionContent({ 46
49 captionPath 47 this.videoCaptionService.getCaptionContent({ captionPath })
50 }).subscribe((res) => { 48 .subscribe(res => {
51 this.form.patchValue({ 49 this.form.patchValue({
52 captionFileContent: res 50 captionFileContent: res
53 }) 51 })
54 }) 52 })
55 }
56 } 53 }
57 54
58 show () { 55 show () {
59 this.closingModal = false
60
61 this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false }) 56 this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false })
62 } 57 }
63 58
64 hide () { 59 hide () {
65 this.closingModal = true
66 this.openedModal.close() 60 this.openedModal.close()
67 } 61 }
68 62
@@ -70,14 +64,11 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
70 this.hide() 64 this.hide()
71 } 65 }
72 66
73 isReplacingExistingCaption () {
74 return true
75 }
76
77 updateCaption () { 67 updateCaption () {
78 const format = 'vtt' 68 const format = 'vtt'
79 const languageId = this.videoCaption.language.id 69 const languageId = this.videoCaption.language.id
80 const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) 70 const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
71
81 this.captionEdited.emit({ 72 this.captionEdited.emit({
82 language: languageObject, 73 language: languageObject,
83 captionfile: new File([ this.form.value['captionFileContent'] ], `${languageId}.${format}`, { 74 captionfile: new File([ this.form.value['captionFileContent'] ], `${languageId}.${format}`, {
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 0f4d0619b..2801fc519 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
@@ -59,7 +59,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
59 @Input() userVideoChannels: SelectChannelItem[] = [] 59 @Input() userVideoChannels: SelectChannelItem[] = []
60 @Input() forbidScheduledPublication = true 60 @Input() forbidScheduledPublication = true
61 61
62 @Input() videoCaptions: (VideoCaptionWithPathEdit)[] = [] 62 @Input() videoCaptions: VideoCaptionWithPathEdit[] = []
63 63
64 @Input() waitTranscodingEnabled = true 64 @Input() waitTranscodingEnabled = true
65 @Input() type: VideoEditType 65 @Input() type: VideoEditType
diff --git a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts
index 67eb09e4d..00ebe5bc6 100644
--- a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts
+++ b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts
@@ -7,8 +7,8 @@ import { objectToFormData, sortBy } from '@app/helpers'
7import { VideoService } from '@app/shared/shared-main/video' 7import { VideoService } from '@app/shared/shared-main/video'
8import { peertubeTranslate } from '@shared/core-utils/i18n' 8import { peertubeTranslate } from '@shared/core-utils/i18n'
9import { ResultList, VideoCaption } from '@shared/models' 9import { ResultList, VideoCaption } from '@shared/models'
10import { VideoCaptionEdit } from './video-caption-edit.model'
11import { environment } from '../../../../environments/environment' 10import { environment } from '../../../../environments/environment'
11import { VideoCaptionEdit } from './video-caption-edit.model'
12 12
13@Injectable() 13@Injectable()
14export class VideoCaptionService { 14export class VideoCaptionService {
@@ -69,6 +69,6 @@ export class VideoCaptionService {
69 } 69 }
70 70
71 getCaptionContent ({ captionPath }: Pick<VideoCaption, 'captionPath'>) { 71 getCaptionContent ({ captionPath }: Pick<VideoCaption, 'captionPath'>) {
72 return this.authHttp.get(`${environment.originServerUrl}${captionPath}`, { responseType: 'text' }) 72 return this.authHttp.get(environment.originServerUrl + captionPath, { responseType: 'text' })
73 } 73 }
74} 74}