diff --git a/src/backend/html_markdown.py b/src/backend/html_markdown.py index 41ce3894..c9776316 100644 --- a/src/backend/html_markdown.py +++ b/src/backend/html_markdown.py @@ -337,6 +337,7 @@ class HTMLProcessor: self._img_to_a, self._remove_extra_newlines, self._newlines_to_return_symbol if inline else lambda el: el, + self._reply_to_inline if inline else lambda el: el, ], "element_postprocessors": [ self._font_color_to_span if outgoing else lambda el: el, @@ -458,6 +459,16 @@ class HTMLProcessor: return el + def _reply_to_inline(self, el: HtmlElement) -> HtmlElement: + """Turn into a plaintext inline form.""" + + if el.tag != "mx-reply": + return el + + el.tail = f" ⏎⏎ {el.tail or ''}" + return el + + def _mentions_to_matrix_to_links( self, el: HtmlElement, diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 2912833e..4b6c07f6 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -2230,10 +2230,13 @@ class MatrixClient(nio.AsyncClient): body = f"{sender}: {item.inline_content}" NotificationRequested( - title = room_name, - body = body.replace(" ⏎ ", "
"), high_importance = highlight, - image = await self.get_notification_avatar( + title = room_name, + + body = body.replace(" ⏎ ", "
") + .replace(" ⏎⏎ ", f"
{'─' * 24}
"), + + image = await self.get_notification_avatar( mxc=item.sender_avatar, user_id=item.sender_id, ) if item.sender_avatar else "", )