3 declare(strict_types=1);
5 namespace BookStack\Activity\Controllers;
7 use BookStack\Activity\CommentRepo;
8 use BookStack\Http\ApiController;
9 use Illuminate\Http\JsonResponse;
11 class CommentApiController extends ApiController
13 // TODO - Add tree-style comment listing to page-show responses.
20 // TODO - Test visibility controls
21 // TODO - Test permissions of each action
23 // TODO - Support intro block for API docs so we can explain the
24 // properties for comments in a shared kind of way?
26 public function __construct(
27 protected CommentRepo $commentRepo,
33 * Get a listing of comments visible to the user.
35 public function list(): JsonResponse
37 $query = $this->commentRepo->getQueryForVisible();
39 return $this->apiListingResponse($query, [
40 'id', 'commentable_id', 'commentable_type', 'parent_id', 'local_id', 'content_ref', 'created_by', 'updated_by', 'created_at', 'updated_at'