initialize settings when using API or starting app
This commit is contained in:
parent
bab1e774da
commit
67edbc1ffd
|
@ -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
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue