diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index bdd216b3..4b022869 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -884,10 +884,19 @@ class MatrixClient(nio.AsyncClient): Returns a list of sucessful redacts. """ - return await asyncio.gather(*[ - self.room_redact(room_id, ev_id, reason) - for ev_id in event_ids - ]) + model = self.models[self.user_id, room_id, "events"] + gather_list = [] + + for event in model._sorted_data: + if event.event_id in event_ids: + event.is_local_echo = True + event.content = "Removing..." + event.event_type = nio.RedactedEvent + gather_list.append( + self.room_redact(room_id, event.event_id, reason), + ) + + return await asyncio.gather(*gather_list) async def generate_thumbnail( diff --git a/src/backend/nio_callbacks.py b/src/backend/nio_callbacks.py index f09dbacd..0f5f83ab 100644 --- a/src/backend/nio_callbacks.py +++ b/src/backend/nio_callbacks.py @@ -172,7 +172,10 @@ class NioCallbacks: event = existing break - if not (event and event.event_type is not nio.RedactedEvent): + if not ( + event and + (event.event_type is not nio.RedactedEvent or event.is_local_echo) + ): return event.source.source["content"] = {}