mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-25 16:19:59 +08:00
Added code in the settings to disable comments. Based on that hiding the comments section on the page display.
This commit is contained in:
@ -161,13 +161,19 @@ class PageController extends Controller
|
||||
$page->html = $this->entityRepo->renderPage($page);
|
||||
$sidebarTree = $this->entityRepo->getBookChildren($page->book);
|
||||
$pageNav = $this->entityRepo->getPageNav($page->html);
|
||||
$page->load(['comments.createdBy']);
|
||||
|
||||
// check if the comment's are enabled
|
||||
$areCommentsEnabled = !setting('app-disable-comments');
|
||||
if ($areCommentsEnabled) {
|
||||
$page->load(['comments.createdBy']);
|
||||
}
|
||||
|
||||
Views::add($page);
|
||||
$this->setPageTitle($page->getShortName());
|
||||
return view('pages/show', [
|
||||
'page' => $page,'book' => $page->book,
|
||||
'current' => $page, 'sidebarTree' => $sidebarTree,
|
||||
'commentsEnabled' => $areCommentsEnabled,
|
||||
'pageNav' => $pageNav]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user