From 3145f32812bb73a16970f17da69e5efc0ae83832 Mon Sep 17 00:00:00 2001 From: HgO Date: Thu, 18 Apr 2024 10:33:55 +0200 Subject: [PATCH] render mention in html --- matrix_alertbot/command.py | 3 ++- tests/test_command.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/matrix_alertbot/command.py b/matrix_alertbot/command.py index a714d74..3969566 100644 --- a/matrix_alertbot/command.py +++ b/matrix_alertbot/command.py @@ -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'{sender_user_name} {reply}', notice=False, ) diff --git a/tests/test_command.py b/tests/test_command.py index b1f7834..8cef56a 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -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, + '^@some_other_fake_user:example.com ', + ) @patch.object(matrix_alertbot.command, "send_text_to_room") async def test_help_with_unknown_topic(self, fake_send_text_to_room: Mock) -> None: