jenkins-bot has submitted this change and it was merged.

Change subject: Keep the uploads sorted in the order they were created in 
initially
......................................................................


Keep the uploads sorted in the order they were created in initially

It might be better to track this issue down to the source and find out
the point where the order changes, but the data flow here is scary.

Bug: T92801
Change-Id: I338a0941467fa2d7a5e79760e5f156de48fe07a4
---
M resources/controller/uw.controller.Step.js
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/controller/uw.controller.Step.js 
b/resources/controller/uw.controller.Step.js
index 7c24c03..df61591 100644
--- a/resources/controller/uw.controller.Step.js
+++ b/resources/controller/uw.controller.Step.js
@@ -85,6 +85,18 @@
 
                this.uploads = uploads || [];
 
+               // Keep the uploads sorted in the order they were created in 
initially.
+               this.uploads = this.uploads.sort( function ( uploadA, uploadB ) 
{
+                       // Can the uploads be undefined? Code below would imply 
they can, no idea how.
+                       if ( !uploadA ) {
+                               return 1;
+                       }
+                       if ( !uploadB ) {
+                               return -1;
+                       }
+                       return uploadA.index - uploadB.index;
+               } );
+
                $.each( this.uploads, function ( i, upload ) {
                        if ( upload !== undefined ) {
                                upload.state = step.stepName;

-- 
To view, visit https://gerrit.wikimedia.org/r/234530
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I338a0941467fa2d7a5e79760e5f156de48fe07a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <matma....@gmail.com>
Gerrit-Reviewer: MarkTraceur <mtrac...@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to