Comments: Removed remaining uses of redundant 'text' field

Opened #4821 to remove the DB field in a few releases time.
This commit is contained in:
Dan Brown 2024-01-31 16:35:58 +00:00
parent 06901b878f
commit fee9045dac
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
4 changed files with 6 additions and 11 deletions

View File

@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
/** /**
* @property int $id * @property int $id
* @property string $text * @property string $text - Deprecated & now unused (#4821)
* @property string $html * @property string $html
* @property int|null $parent_id - Relates to local_id, not id * @property int|null $parent_id - Relates to local_id, not id
* @property int $local_id * @property int $local_id
@ -25,7 +25,7 @@ class Comment extends Model implements Loggable
use HasFactory; use HasFactory;
use HasCreatorAndUpdater; use HasCreatorAndUpdater;
protected $fillable = ['text', 'parent_id']; protected $fillable = ['parent_id'];
protected $appends = ['created', 'updated']; protected $appends = ['created', 'updated'];
/** /**

View File

@ -25,7 +25,6 @@ class CommentFactory extends Factory
return [ return [
'html' => $html, 'html' => $html,
'text' => $text,
'parent_id' => null, 'parent_id' => null,
'local_id' => 1, 'local_id' => 1,
]; ];

View File

@ -18,10 +18,10 @@ class CommentTest extends TestCase
$resp = $this->postJson("/comment/$page->id", $comment->getAttributes()); $resp = $this->postJson("/comment/$page->id", $comment->getAttributes());
$resp->assertStatus(200); $resp->assertStatus(200);
$resp->assertSee($comment->text); $resp->assertSee($comment->html, false);
$pageResp = $this->get($page->getUrl()); $pageResp = $this->get($page->getUrl());
$pageResp->assertSee($comment->text); $pageResp->assertSee($comment->html, false);
$this->assertDatabaseHas('comments', [ $this->assertDatabaseHas('comments', [
'local_id' => 1, 'local_id' => 1,

View File

@ -738,16 +738,12 @@ class RolePermissionsTest extends TestCase
private function addComment(Page $page): TestResponse private function addComment(Page $page): TestResponse
{ {
$comment = Comment::factory()->make(); return $this->postJson("/comment/$page->id", ['html' => '<p>New comment content</p>']);
return $this->postJson("/comment/$page->id", $comment->only('text', 'html'));
} }
private function updateComment(Comment $comment): TestResponse private function updateComment(Comment $comment): TestResponse
{ {
$commentData = Comment::factory()->make(); return $this->putJson("/comment/{$comment->id}", ['html' => '<p>Updated comment content</p>']);
return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html'));
} }
private function deleteComment(Comment $comment): TestResponse private function deleteComment(Comment $comment): TestResponse