From 0743bca542bdb2e555291a1d5fd12f4a9b05013e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Sun, 25 Feb 2018 15:29:07 +0100 Subject: [PATCH] Refactor the message modification in redactions. --- matrix/rooms.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/matrix/rooms.py b/matrix/rooms.py index b7cff8a..6cb84aa 100644 --- a/matrix/rooms.py +++ b/matrix/rooms.py @@ -470,13 +470,16 @@ class RoomRedactionEvent(RoomEvent): censor=censor, reason=reason) + new_message = "" + if OPTIONS.redaction_type == RedactType.STRIKETHROUGH: - message = string_strikethrough(message) - message = message + " " + redaction_msg - elif OPTIONS.redaction_type == RedactType.DELETE: - message = redaction_msg + new_message = string_strikethrough(message) elif OPTIONS.redaction_type == RedactType.NOTICE: - message = message + " " + redaction_msg + new_message = message + elif OPTIONS.redaction_type == RedactType.DELETE: + pass + + message = " ".join(s for s in [new_message, redaction_msg] if s) tags.append("matrix_redacted")