fix: speed up event redaction

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-12-20 12:20:05 +01:00
parent 5ee4514997
commit b6819aa400

View File

@ -549,10 +549,11 @@ class ChatController extends State<Chat> {
) == ) ==
OkCancelResult.ok; OkCancelResult.ok;
if (!confirmed) return; if (!confirmed) return;
for (final event in selectedEvents) {
await showFutureLoadingDialog( await showFutureLoadingDialog(
context: context, context: context,
future: () async { future: () => Future.wait(
selectedEvents.map(
(event) async {
if (event.status.isSent) { if (event.status.isSent) {
if (event.canRedact) { if (event.canRedact) {
await event.redactEvent(); await event.redactEvent();
@ -569,8 +570,11 @@ class ChatController extends State<Chat> {
} else { } else {
await event.remove(); await event.remove();
} }
}); },
} ),
),
);
setState(() { setState(() {
showEmojiPicker = false; showEmojiPicker = false;
selectedEvents.clear(); selectedEvents.clear();