X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fapp%2Fvideos%2F%2Bvideo-edit%2Fshared%2Fvideo-edit.component.ts;h=b394a13e4932c5fa8125dde7c13e72a826fcbe4f;hb=ad77475251c3516dd5851a08655be79d7bf76245;hp=b8aef99ddb94ef2c9ea5c558fb9540c25096fa1d;hpb=f842e810b450a34275d8d453d5d9431a4e1b882a;p=github%2FChocobozzz%2FPeerTube.git 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 b8aef99dd..b394a13e4 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 @@ -142,12 +142,13 @@ export class VideoEditComponent implements OnInit, OnDestroy { // Replace existing caption? if (existingCaption) { Object.assign(existingCaption, caption, { action: 'CREATE' as 'CREATE' }) - return + } else { + this.videoCaptions.push( + Object.assign(caption, { action: 'CREATE' as 'CREATE' }) + ) } - this.videoCaptions.push( - Object.assign(caption, { action: 'CREATE' as 'CREATE' }) - ) + this.sortVideoCaptions() } async deleteCaption (caption: VideoCaptionEdit) { @@ -170,6 +171,15 @@ export class VideoEditComponent implements OnInit, OnDestroy { this.videoCaptionAddModal.show() } + private sortVideoCaptions () { + this.videoCaptions.sort((v1, v2) => { + if (v1.language.label < v2.language.label) return -1 + if (v1.language.label === v2.language.label) return 0 + + return 1 + }) + } + private trackPrivacyChange () { // We will update the "support" field depending on the channel this.form.controls[ 'privacy' ]