X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a6633642232efd164d4708967ab59e498fbff896..refs/pull/3032/head:/app/Actions/CommentRepo.php diff --git a/app/Actions/CommentRepo.php b/app/Actions/CommentRepo.php index 13a83e7fd..85fb6498a 100644 --- a/app/Actions/CommentRepo.php +++ b/app/Actions/CommentRepo.php @@ -1,21 +1,21 @@ -comment = $comment; @@ -46,6 +46,7 @@ class CommentRepo $entity->comments()->save($comment); ActivityService::addForEntity($entity, ActivityType::COMMENTED_ON); + return $comment; } @@ -58,6 +59,7 @@ class CommentRepo $comment->text = $text; $comment->html = $this->commentToHtml($text); $comment->save(); + return $comment; } @@ -75,8 +77,8 @@ class CommentRepo public function commentToHtml(string $commentText): string { $converter = new CommonMarkConverter([ - 'html_input' => 'strip', - 'max_nesting_level' => 10, + 'html_input' => 'strip', + 'max_nesting_level' => 10, 'allow_unsafe_links' => false, ]); @@ -89,6 +91,7 @@ class CommentRepo protected function getNextLocalId(Entity $entity): int { $comments = $entity->comments(false)->orderBy('local_id', 'desc')->first(); + return ($comments->local_id ?? 0) + 1; } }