Open ashwingj opened 9 years ago
On dumping the $filters variable in the ApiPhotoController list_() function I noticed that
{"sortBy":"dateUploaded,desc","album":"7","returnSizes":"960x180,870x870,180x180xCR","__route__":"\/photos\/album-7\/list"}
{"sortBy":"dateTaken,asc","album":"7","__route__":"\/photos\/album-7\/list.json","returnSizes":"960x180,870x870,180x180xCR","page":"2"}
Surprising that the sortBy is different on the incremental load
The PhotoController::list_() function seems to want to set 'dateTaken,asc' behaviour when listing an Album OR Tag versus default listing ... See code snippet below
if($isAlbum || $isTags)
{
if(!isset($getParams['sortBy']))
$additionalParams['sortBy'] = 'dateTaken,asc';
if($isAlbum)
$additionalParams['pageSize'] = '0';
}
This IF condition is however not entered and $isAlbum and $isTag are both raising PHP Notice: Undefined variable errors in the error log. Could this be the problem?
While looking for client side behaviour, came across this code (4.0.2\tbx.js)
load: function() {
var _this = TBX.init.pages.photos, async = typeof(arguments[0]) === 'undefined' ? true : arguments[0], concat = _this.pageLocation.search.length == 0 ? '?' : '&';
// since sort order for the API is static and onload changes the sort order for albums and gallery we need to mimic the controller behavior in JS
if(_this.pageLocation.search.search('sortBy') === -1) {
if(_this.pageLocation.pathname.search('/album-') === -1) // gallery
_this.pageLocation.search += concat + 'sortBy=dateUploaded,desc';
else // album
_this.pageLocation.search += concat + 'sortBy=dateTaken,asc';
}
util.load(_this, async);
},
This looks contrary to the server side code. The 'dateTaken,asc' behaviour is applied only to album listings. Tag listings (/tags-) and gallery listings both default to dateUploaded.
As expected, I cannot reproduce the original bug in either the gallery listing or tag listing as the incremental loads maintain the sorting behaviour of the initial load.
@jmathai, I can't find where $isAlbum and $isTag are to be set (on the server side). A simple text search of the code did not reveal any place where either of those variables were being assigned. Can you perhaps shed some light?
I created an album containing 96 photos (actually it was 97 and i deleted one). Then i noticed
Other symptoms
Looks like a paging bug.