]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Tools/PageEditorData.php
Queries: Addressed failing test cases from recent changes
[bookstack] / app / Entities / Tools / PageEditorData.php
index 20bf19eb2f4bc7a25b1935970624f427ebbe735d..f0bd235897d97017e45f0eb22fd37142cd1fa54d 100644 (file)
@@ -38,7 +38,8 @@ class PageEditorData
         $templates = $this->queries->pages->visibleTemplates()
             ->orderBy('name', 'asc')
             ->take(10)
-            ->get();
+            ->paginate()
+            ->withPath('/templates');
 
         $draftsEnabled = auth()->check();
 
@@ -51,7 +52,7 @@ class PageEditorData
         }
 
         // Check for a current draft version for this user
-        $userDraft = $this->queries->revisions->findLatestCurrentUserDraftsForPageId($page->id)->first();
+        $userDraft = $this->queries->revisions->findLatestCurrentUserDraftsForPageId($page->id);
         if (!is_null($userDraft)) {
             $page->forceFill($userDraft->only(['name', 'html', 'markdown']));
             $isDraftRevision = true;