diff options
Diffstat (limited to 'client/src/app/videos')
-rw-r--r-- | client/src/app/videos/+video-edit/shared/video-edit.component.ts | 18 |
1 files changed, 14 insertions, 4 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 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 { | |||
142 | // Replace existing caption? | 142 | // Replace existing caption? |
143 | if (existingCaption) { | 143 | if (existingCaption) { |
144 | Object.assign(existingCaption, caption, { action: 'CREATE' as 'CREATE' }) | 144 | Object.assign(existingCaption, caption, { action: 'CREATE' as 'CREATE' }) |
145 | return | 145 | } else { |
146 | this.videoCaptions.push( | ||
147 | Object.assign(caption, { action: 'CREATE' as 'CREATE' }) | ||
148 | ) | ||
146 | } | 149 | } |
147 | 150 | ||
148 | this.videoCaptions.push( | 151 | this.sortVideoCaptions() |
149 | Object.assign(caption, { action: 'CREATE' as 'CREATE' }) | ||
150 | ) | ||
151 | } | 152 | } |
152 | 153 | ||
153 | async deleteCaption (caption: VideoCaptionEdit) { | 154 | async deleteCaption (caption: VideoCaptionEdit) { |
@@ -170,6 +171,15 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
170 | this.videoCaptionAddModal.show() | 171 | this.videoCaptionAddModal.show() |
171 | } | 172 | } |
172 | 173 | ||
174 | private sortVideoCaptions () { | ||
175 | this.videoCaptions.sort((v1, v2) => { | ||
176 | if (v1.language.label < v2.language.label) return -1 | ||
177 | if (v1.language.label === v2.language.label) return 0 | ||
178 | |||
179 | return 1 | ||
180 | }) | ||
181 | } | ||
182 | |||
173 | private trackPrivacyChange () { | 183 | private trackPrivacyChange () { |
174 | // We will update the "support" field depending on the channel | 184 | // We will update the "support" field depending on the channel |
175 | this.form.controls[ 'privacy' ] | 185 | this.form.controls[ 'privacy' ] |