0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-07 17:40:57 +00:00

Comments: Updated to show as nested threads

Initial functional implementation, a lot of tweaking and adapting to be
done.
This commit is contained in:
Dan Brown 2023-06-07 13:24:49 +01:00
parent 88785aa71b
commit 4b9f6beb37
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
8 changed files with 143 additions and 35 deletions
app/Entities/Controllers

View file

@ -3,6 +3,7 @@
namespace BookStack\Entities\Controllers;
use BookStack\Activity\Models\View;
use BookStack\Activity\Tools\CommentTree;
use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\PageRepo;
use BookStack\Entities\Tools\BookContents;
@ -140,15 +141,10 @@ class PageController extends Controller
$pageContent = (new PageContent($page));
$page->html = $pageContent->render();
$sidebarTree = (new BookContents($page->book))->getTree();
$pageNav = $pageContent->getNavigation($page->html);
// Check if page comments are enabled
$commentsEnabled = !setting('app-disable-comments');
if ($commentsEnabled) {
$page->load(['comments.createdBy']);
}
$sidebarTree = (new BookContents($page->book))->getTree();
$commentTree = (new CommentTree($page));
$nextPreviousLocator = new NextPreviousContentLocator($page, $sidebarTree);
View::incrementFor($page);
@ -159,7 +155,7 @@ class PageController extends Controller
'book' => $page->book,
'current' => $page,
'sidebarTree' => $sidebarTree,
'commentsEnabled' => $commentsEnabled,
'commentTree' => $commentTree,
'pageNav' => $pageNav,
'next' => $nextPreviousLocator->getNext(),
'previous' => $nextPreviousLocator->getPrevious(),