diff --git a/lib/Controller/Helper.php b/lib/Controller/Helper.php index ff416e80..ca3df1ae 100644 --- a/lib/Controller/Helper.php +++ b/lib/Controller/Helper.php @@ -74,7 +74,7 @@ class Helper { $userId = $this->getUID(); $chunkCursor = $chunkCursorStr ? ChunkCursor::fromString($chunkCursorStr) : null; $lastUpdate = $chunkCursor->timeStart ?? new \DateTime(); - $data = $this->notesService->getAll($userId, true); + $data = $this->notesService->getAll($userId, true); // auto-create notes folder if not exists $metaNotes = $this->metaService->getAll($userId, $data['notes']); // if a category is requested, then ignore all other notes diff --git a/lib/Controller/NotesApiController.php b/lib/Controller/NotesApiController.php index 62c6ad19..2c869c53 100644 --- a/lib/Controller/NotesApiController.php +++ b/lib/Controller/NotesApiController.php @@ -55,6 +55,10 @@ class NotesApiController extends ApiController { $chunkSize, $chunkCursor ) { + // initialize settings + $userId = $this->helper->getUID(); + $this->settingsService->getAll($userId, true); + // load notes and categories $exclude = explode(',', $exclude); $data = $this->helper->getNotesAndCategories($pruneBefore, $exclude, $category, $chunkSize, $chunkCursor); $notesData = $data['notesData']; diff --git a/lib/Controller/NotesController.php b/lib/Controller/NotesController.php index a78aa50c..15460398 100644 --- a/lib/Controller/NotesController.php +++ b/lib/Controller/NotesController.php @@ -49,6 +49,7 @@ class NotesController extends Controller { public function index(int $pruneBefore = 0) : JSONResponse { return $this->helper->handleErrorResponse(function () use ($pruneBefore) { $userId = $this->helper->getUID(); + // initialize and load settings $settings = $this->settingsService->getAll($userId, true); $lastViewedNote = (int) $this->settings->getUserValue( diff --git a/lib/Service/SettingsService.php b/lib/Service/SettingsService.php index bbc8e718..d3bdbdbd 100644 --- a/lib/Service/SettingsService.php +++ b/lib/Service/SettingsService.php @@ -168,7 +168,9 @@ class SettingsService { } public function getPublic(string $uid) : \stdClass { - $settings = $this->getAll($uid); + // initialize and load settings + $settings = $this->getAll($uid, true); + // translate internal settings to public settings if ($settings->fileSuffix === 'custom') { $settings->fileSuffix = $settings->customSuffix; }