Add redact echo before we receive RedactionEvent

This commit is contained in:
vSLG 2020-04-02 21:51:53 -03:00 committed by miruka
parent f8fe5d812b
commit af861ac13a
2 changed files with 17 additions and 5 deletions

View File

@ -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(

View File

@ -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"] = {}