1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Comments: Added archive endpoints, messages, Js actions and tests

This commit is contained in:
Dan Brown
2025-04-28 15:37:09 +01:00
parent e8f44186a8
commit 8bdf948743
9 changed files with 155 additions and 1 deletions

View File

@ -75,6 +75,42 @@ class CommentController extends Controller
]);
}
/**
* Mark a comment as archived.
*/
public function archive(int $id)
{
$comment = $this->commentRepo->getById($id);
if (!userCan('comment-update', $comment) && !userCan('comment-delete', $comment)) {
$this->showPermissionError();
}
$this->commentRepo->archive($comment);
return view('comments.comment', [
'comment' => $comment,
'readOnly' => false,
]);
}
/**
* Unmark a comment as archived.
*/
public function unarchive(int $id)
{
$comment = $this->commentRepo->getById($id);
if (!userCan('comment-update', $comment) && !userCan('comment-delete', $comment)) {
$this->showPermissionError();
}
$this->commentRepo->unarchive($comment);
return view('comments.comment', [
'comment' => $comment,
'readOnly' => false,
]);
}
/**
* Delete a comment from the system.
*/