diff --git a/lib/Controller/ApiBase.php b/lib/Controller/ApiBase.php index 4f7618fc..1916cca4 100644 --- a/lib/Controller/ApiBase.php +++ b/lib/Controller/ApiBase.php @@ -148,6 +148,11 @@ class ApiBase extends Controller return null !== $this->request->getParam('monthView'); } + protected function isReverse() + { + return null !== $this->request->getParam('reverse'); + } + protected function getShareToken() { return $this->request->getParam('folder_share'); diff --git a/lib/Controller/DaysController.php b/lib/Controller/DaysController.php index 2df870ca..d46ab8db 100644 --- a/lib/Controller/DaysController.php +++ b/lib/Controller/DaysController.php @@ -67,6 +67,11 @@ class DaysController extends ApiBase $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 if (!$this->isRecursive()) { 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); } catch (\Exception $e) { return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR); diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index e0bc5d0b..44b030ba 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -541,6 +541,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { // Month view if (this.isMonthView()) { query.set("monthView", "1"); + query.set("reverse", "1"); } // Create query string and append to URL