Merge branch 'Bajszi97/development' into development

This commit is contained in:
Dan Brown 2023-09-13 10:12:49 +01:00
commit 709c182bda
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
2 changed files with 13 additions and 1 deletions

View file

@ -345,7 +345,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
return $splitName[0];
}
return '';
return mb_substr($this->name, 0, max($chars - 2, 0)) . '';
}
/**

View file

@ -152,4 +152,16 @@ class CommentTest extends TestCase
$respHtml = $this->withHtml($this->get($page->getUrl('/edit')));
$respHtml->assertElementContains('.comment-box .content', 'My great comment to see in the editor');
}
public function test_comment_creator_name_truncated()
{
[$longNamedUser] = $this->users->newUserWithRole(['name' => 'Wolfeschlegelsteinhausenbergerdorff'], ['comment-create-all', 'page-view-all']);
$page = $this->entities->page();
$comment = Comment::factory()->make();
$this->actingAs($longNamedUser)->postJson("/comment/$page->id", $comment->getAttributes());
$pageResp = $this->asAdmin()->get($page->getUrl());
$pageResp->assertSee('Wolfeschlegels…');
}
}