Brion VIBBER has submitted this change and it was merged. Change subject: Bug 44693: Ensure uploads dashboard uploads are in correct order ......................................................................
Bug 44693: Ensure uploads dashboard uploads are in correct order Map to an array and use timestamp to sort before rendering. Sigh damn you api... Change-Id: Ifc58cfe06267123decf100bb27a0c3f8ef3b6bb5 --- M javascripts/specials/donateimage.js 1 file changed, 16 insertions(+), 3 deletions(-) Approvals: Brion VIBBER: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/javascripts/specials/donateimage.js b/javascripts/specials/donateimage.js index 7fdf976..29439b1 100644 --- a/javascripts/specials/donateimage.js +++ b/javascripts/specials/donateimage.js @@ -40,8 +40,12 @@ function getImageDataFromPage( page ) { var img = page.imageinfo[0]; - return { url: img.thumburl, fileName: img.name, title: page.title, - descriptionUrl: img.descriptionurl }; + return { + url: img.thumburl, + title: page.title, + timestamp: img.timestamp, + descriptionUrl: img.descriptionurl + }; } function extractDescription( text ) { @@ -97,7 +101,8 @@ gailimit: 10, prop: 'imageinfo', origin: corsUrl ? M.getOrigin() : undefined, - iiprop: 'url', + // FIXME: have to request timestamp since api returns a json rather than an array thus we need a way to sort + iiprop: 'url|timestamp', iiurlwidth: IMAGE_WIDTH }, xhrFields: { @@ -112,7 +117,15 @@ data[ this.title ] = getImageDataFromPage( this ); } ); appendDescriptions( data, function( imageData ) { + var fileArray = []; + // FIXME: API work around - in an ideal world imageData would be an array $.each( imageData, function() { + fileArray.push( this ); + } ); + fileArray = fileArray.sort( function( a, b ) { + return a.timestamp > b.timestamp ? 1 : -1; + } ); + $.each( fileArray, function() { userGallery.addPhoto( this ); } ); } ); -- To view, visit https://gerrit.wikimedia.org/r/51297 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifc58cfe06267123decf100bb27a0c3f8ef3b6bb5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: JGonera <jgon...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits