1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-11-06 00:50:36 +03:00

API: Added comment tree to pages-read endpoint

Includes tests to cover
This commit is contained in:
Dan Brown
2025-10-24 10:18:52 +01:00
parent fcacf7cacb
commit 4627dfd4f7
5 changed files with 69 additions and 8 deletions

View File

@@ -13,6 +13,11 @@ class CommentFactory extends Factory
*/
protected $model = \BookStack\Activity\Models\Comment::class;
/**
* A static counter to provide a unique local_id for each comment.
*/
protected static int $nextLocalId = 1000;
/**
* Define the model's default state.
*
@@ -22,11 +27,12 @@ class CommentFactory extends Factory
{
$text = $this->faker->paragraph(1);
$html = '<p>' . $text . '</p>';
$nextLocalId = static::$nextLocalId++;
return [
'html' => $html,
'parent_id' => null,
'local_id' => 1,
'local_id' => $nextLocalId,
'content_ref' => '',
'archived' => false,
];