"X removed this event": say "message" instead

That's what was supposed to happen for non-media message events
since redactions were implemented, but seems like nio doesn't
properly keep the original event type.
This commit is contained in:
miruka 2020-09-04 14:52:10 -04:00
parent ebfc3d3ee2
commit 56f676e35d

View File

@ -1294,14 +1294,8 @@ class MatrixClient(nio.AsyncClient):
) -> str: ) -> str:
"""Get content to be displayed in place of a redacted event.""" """Get content to be displayed in place of a redacted event."""
kind = ( content = "%1 removed this message" if redacter == sender else \
"message" if issubclass(nio_type, nio.RoomMessage) else "%1's message was removed by %2"
"media" if issubclass(nio_type, nio.RoomMessageMedia) else
"event"
)
content = f"%1 removed this {kind}" if redacter == sender else \
f"%1's {kind} was removed by %2"
if reason: if reason:
content = f"{content}, reason: {html.escape(reason)}" content = f"{content}, reason: {html.escape(reason)}"