NOW MANAGED ON CODEBERG
Comments: Added visual nesting limit, added nesting test
Dan Brown3bede42121d2
diff --git a/resources/sass/_components.scss b/resources/sass/_components.scssindex a3818168f..f75f8b8f8 100644--- a/resources/sass/_components.scss+++ b/resources/sass/_components.scss@@ -663,6 +663,12 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {}}+.comments-container {+ padding-inline: $-xl;+ @include smaller-than($m) {+ padding-inline: $-xs;+ }+}.comment-box {border-radius: 4px;border: 1px solid #DDD;@@ -715,6 +721,10 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {height: calc(100% - $-m);}+.comment-branch .comment-branch .comment-branch .comment-branch .comment-thread-indicator {+ display: none;+}+#tag-manager .drag-card {max-width: 500px;}diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.phpindex fa6b1a2cd..ae6b273fe 100644--- a/resources/views/pages/show.blade.php+++ b/resources/views/pages/show.blade.php@@ -34,7 +34,7 @@</div>@endif- <div class="px-xl comments-container mb-l print-hidden">+ <div class="comments-container mb-l print-hidden">@include('comments.comments', ['commentTree' => $commentTree, 'page' => $page])<div class="clearfix"></div></div>diff --git a/tests/Entity/CommentTest.php b/tests/Entity/CommentTest.phpindex 1159df79d..a04933ada 100644--- a/tests/Entity/CommentTest.php+++ b/tests/Entity/CommentTest.php@@ -114,4 +114,25 @@ class CommentTest extends TestCase$pageView->assertDontSee($script, false);$pageView->assertSee('sometextinthecommentupdated');}++ public function test_reply_comments_are_nested()+ {+ $this->asAdmin();+ $page = $this->entities->page();++ $this->postJson("/comment/$page->id", ['text' => 'My new comment']);+ $this->postJson("/comment/$page->id", ['text' => 'My new comment']);++ $respHtml = $this->withHtml($this->get($page->getUrl()));+ $respHtml->assertElementCount('.comment-branch', 3);+ $respHtml->assertElementNotExists('.comment-branch .comment-branch');++ $comment = $page->comments()->first();+ $resp = $this->postJson("/comment/$page->id", ['text' => 'My nested comment', 'parent_id' => $comment->local_id]);+ $resp->assertStatus(200);++ $respHtml = $this->withHtml($this->get($page->getUrl()));+ $respHtml->assertElementCount('.comment-branch', 4);+ $respHtml->assertElementContains('.comment-branch .comment-branch', 'My nested comment');+ }}