render mention in html

This commit is contained in:
HgO 2024-04-18 10:33:55 +02:00
parent acd9f1764d
commit 3145f32812
2 changed files with 7 additions and 2 deletions

View file

@ -274,7 +274,8 @@ class AngryUserCommand(BaseCommand):
await send_text_to_room(
self.matrix_client,
self.room.room_id,
f"{sender_user_name} {reply}",
plaintext=f"{sender_user_name} {reply}",
html=f'<a href="https://matrix.to/#/{self.sender}">{sender_user_name}</a> {reply}',
notice=False,
)

View file

@ -713,11 +713,15 @@ class CommandTestCase(unittest.IsolatedAsyncioTestCase):
# Check that we attempted to create silences
fake_send_text_to_room.assert_called_once()
_, _, text = fake_send_text_to_room.call_args.args
text, html, _ = fake_send_text_to_room.call_args.kwargs.values()
self.assertRegex(
text,
"^@some_other_fake_user:example.com ",
)
self.assertRegex(
html,
'^<a href="https://matrix.to/#/@some_other_fake_user:example.com">@some_other_fake_user:example.com</a> ',
)
@patch.object(matrix_alertbot.command, "send_text_to_room")
async def test_help_with_unknown_topic(self, fake_send_text_to_room: Mock) -> None: