Sort albums ascending (fix #130)

pull/162/head
Varun Patil 2022-11-03 15:44:52 -07:00
parent 80a76a5a48
commit 9fb2ba6d05
3 changed files with 16 additions and 0 deletions

View File

@ -148,6 +148,11 @@ class ApiBase extends Controller
return null !== $this->request->getParam('monthView'); return null !== $this->request->getParam('monthView');
} }
protected function isReverse()
{
return null !== $this->request->getParam('reverse');
}
protected function getShareToken() protected function getShareToken()
{ {
return $this->request->getParam('folder_share'); return $this->request->getParam('folder_share');

View File

@ -67,6 +67,11 @@ class DaysController extends ApiBase
$this->preloadDays($list, $uid, $folder); $this->preloadDays($list, $uid, $folder);
} }
// Reverse response if requested. Folders still stay at top.
if ($this->isReverse()) {
$list = array_reverse($list);
}
// Add subfolder info if querying non-recursively // Add subfolder info if querying non-recursively
if (!$this->isRecursive()) { if (!$this->isRecursive()) {
array_unshift($list, $this->getSubfoldersEntry($folder)); array_unshift($list, $this->getSubfoldersEntry($folder));
@ -136,6 +141,11 @@ class DaysController extends ApiBase
} }
} }
// Reverse response if requested.
if ($this->isReverse()) {
$list = array_reverse($list);
}
return new JSONResponse($list, Http::STATUS_OK); return new JSONResponse($list, Http::STATUS_OK);
} catch (\Exception $e) { } catch (\Exception $e) {
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR); return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);

View File

@ -541,6 +541,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
// Month view // Month view
if (this.isMonthView()) { if (this.isMonthView()) {
query.set("monthView", "1"); query.set("monthView", "1");
query.set("reverse", "1");
} }
// Create query string and append to URL // Create query string and append to URL