From e7a1216ef70e5a35755222af3c4fb1c7df198a44 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 30 Dec 2021 23:34:03 +0200 Subject: [PATCH] Don't redact reactions in chats with relaybot There are usually other Matrix users, so redacting reactions only from logged-in users would be weird. --- mautrix_telegram/portal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py index 1b82332c..d9fc7ff0 100644 --- a/mautrix_telegram/portal.py +++ b/mautrix_telegram/portal.py @@ -1881,7 +1881,11 @@ class Portal(DBPortal, BasePortal): self.log.debug(str(e)) await self._send_bridge_error(user, e, reaction_event_id, EventType.REACTION) except ReactionInvalidError as e: - await self.main_intent.redact(self.mxid, reaction_event_id, reason="Emoji not allowed") + # Don't redact reactions in relaybot chats, there are usually other Matrix users too. + if not self.has_bot: + await self.main_intent.redact( + self.mxid, reaction_event_id, reason="Emoji not allowed" + ) self.log.debug(f"Failed to bridge reaction by {user.mxid}: emoji not allowed") await self._send_bridge_error(user, e, reaction_event_id, EventType.REACTION) except Exception as e: