Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/234530

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/30/234530/1

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: newchange
Gerrit-Change-Id: I338a0941467fa2d7a5e79760e5f156de48fe07a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to