Skip to content

Commit fee9045

Browse files
committed
Comments: Removed remaining uses of redundant 'text' field
Opened #4821 to remove the DB field in a few releases time.
1 parent 06901b8 commit fee9045

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

app/Activity/Models/Comment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* @property int $id
14-
* @property string $text
14+
* @property string $text - Deprecated & now unused (#4821)
1515
* @property string $html
1616
* @property int|null $parent_id - Relates to local_id, not id
1717
* @property int $local_id
@@ -25,7 +25,7 @@ class Comment extends Model implements Loggable
2525
use HasFactory;
2626
use HasCreatorAndUpdater;
2727

28-
protected $fillable = ['text', 'parent_id'];
28+
protected $fillable = ['parent_id'];
2929
protected $appends = ['created', 'updated'];
3030

3131
/**

database/factories/Activity/Models/CommentFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public function definition()
2525

2626
return [
2727
'html' => $html,
28-
'text' => $text,
2928
'parent_id' => null,
3029
'local_id' => 1,
3130
];

tests/Entity/CommentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public function test_add_comment()
1818
$resp = $this->postJson("/comment/$page->id", $comment->getAttributes());
1919

2020
$resp->assertStatus(200);
21-
$resp->assertSee($comment->text);
21+
$resp->assertSee($comment->html, false);
2222

2323
$pageResp = $this->get($page->getUrl());
24-
$pageResp->assertSee($comment->text);
24+
$pageResp->assertSee($comment->html, false);
2525

2626
$this->assertDatabaseHas('comments', [
2727
'local_id' => 1,

tests/Permissions/RolePermissionsTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -738,16 +738,12 @@ public function test_comment_delete_all_permission()
738738

739739
private function addComment(Page $page): TestResponse
740740
{
741-
$comment = Comment::factory()->make();
742-
743-
return $this->postJson("/comment/$page->id", $comment->only('text', 'html'));
741+
return $this->postJson("/comment/$page->id", ['html' => '<p>New comment content</p>']);
744742
}
745743

746744
private function updateComment(Comment $comment): TestResponse
747745
{
748-
$commentData = Comment::factory()->make();
749-
750-
return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html'));
746+
return $this->putJson("/comment/{$comment->id}", ['html' => '<p>Updated comment content</p>']);
751747
}
752748

753749
private function deleteComment(Comment $comment): TestResponse

0 commit comments

Comments
 (0)