feat: Refactor mention rendering and generator classes
- Add support for Mastodon username mentions - Add test for parsing Mastodon usernames in notes - Modify namespace and class imports for `MentionGenerator` and `MentionRenderer` in `Note.php` - Rename `ContactMentionGenerator.php` to `MentionGenerator.php`
This commit is contained in:
parent
3817545cf3
commit
05c63b241d
5 changed files with 55 additions and 31 deletions
|
@ -437,4 +437,15 @@ class NotesTest extends TestCase
|
|||
|
||||
$this->assertSame('<span class="p-country-name">Antarctica</span>', $note->address);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function mastodonUsernamesAreParsedCorrectly(): void
|
||||
{
|
||||
$expected = '<p>Hi <a href="https://phpc.social/@freekmurze">@freekmurze@phpc.social</a> how are you?</p>' . PHP_EOL;
|
||||
$note = Note::factory()->create([
|
||||
'note' => 'Hi @freekmurze@phpc.social how are you?',
|
||||
]);
|
||||
|
||||
$this->assertSame($expected, $note->note);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue