From 2c2f8c8a04c253a6a16f4efe45477e37e88f861e Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Thu, 29 Oct 2015 12:51:22 +0000 Subject: [PATCH] MediaSearch: Order search results correctly Bug: T117036 Change-Id: Ia11f3486214425f203695a6060e304a90eba7734 --- modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js b/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js index b035dc052f..4cc3d65576 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js +++ b/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js @@ -191,11 +191,14 @@ ve.dm.MWMediaResourceProvider.prototype.fetchAPIresults = function ( howMany ) { } newObj = raw[ page ].imageinfo[ 0 ]; newObj.title = raw[ page ].title; + newObj.index = raw[ page ].index; results.push( newObj ); } } } - return results; + return results.sort( function ( a, b ) { + return a.index - b.index; + } ); } ) .promise( { abort: xhr.abort } ); };