MediaSearch: Order search results correctly

Bug: T117036
Change-Id: Ia11f3486214425f203695a6060e304a90eba7734
This commit is contained in:
Ed Sanders 2015-10-29 12:51:22 +00:00
parent 1a92da4a58
commit 2c2f8c8a04

View file

@ -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 } );
};