From b6819aa400dd0e4e02d31b49f10086d6da14fb69 Mon Sep 17 00:00:00 2001 From: TheOneWithTheBraid Date: Tue, 20 Dec 2022 12:20:05 +0100 Subject: [PATCH] fix: speed up event redaction Signed-off-by: TheOneWithTheBraid --- lib/pages/chat/chat.dart | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index e7990a9f..a9091bb6 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -549,10 +549,11 @@ class ChatController extends State { ) == OkCancelResult.ok; if (!confirmed) return; - for (final event in selectedEvents) { - await showFutureLoadingDialog( - context: context, - future: () async { + await showFutureLoadingDialog( + context: context, + future: () => Future.wait( + selectedEvents.map( + (event) async { if (event.status.isSent) { if (event.canRedact) { await event.redactEvent(); @@ -569,8 +570,11 @@ class ChatController extends State { } else { await event.remove(); } - }); - } + }, + ), + ), + ); + setState(() { showEmojiPicker = false; selectedEvents.clear();