From 56f676e35d688adf29822179ece8782402d1f23d Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 4 Sep 2020 14:52:10 -0400 Subject: [PATCH] "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. --- src/backend/matrix_client.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 333b252f..788f7e7f 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -1294,14 +1294,8 @@ class MatrixClient(nio.AsyncClient): ) -> str: """Get content to be displayed in place of a redacted event.""" - kind = ( - "message" if issubclass(nio_type, nio.RoomMessage) else - "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" + content = "%1 removed this message" if redacter == sender else \ + "%1's message was removed by %2" if reason: content = f"{content}, reason: {html.escape(reason)}"