From c273ff64a1f330c571a8e00ec76d253ff15d6768 Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 28 Sep 2023 09:04:13 +0200 Subject: [PATCH] fix: Do not ask for reason to delete not sent messages --- lib/pages/chat/chat.dart | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 885c0ae92..8c3c88c60 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -753,19 +753,21 @@ class ChatController extends State { } void redactEventsAction() async { - final reasonInput = await showTextInputDialog( - context: context, - title: L10n.of(context)!.redactMessage, - message: L10n.of(context)!.redactMessageDescription, - isDestructiveAction: true, - textFields: [ - DialogTextField( - hintText: L10n.of(context)!.optionalRedactReason, - ), - ], - okLabel: L10n.of(context)!.remove, - cancelLabel: L10n.of(context)!.cancel, - ); + final reasonInput = selectedEvents.any((event) => event.status.isSent) + ? await showTextInputDialog( + context: context, + title: L10n.of(context)!.redactMessage, + message: L10n.of(context)!.redactMessageDescription, + isDestructiveAction: true, + textFields: [ + DialogTextField( + hintText: L10n.of(context)!.optionalRedactReason, + ), + ], + okLabel: L10n.of(context)!.remove, + cancelLabel: L10n.of(context)!.cancel, + ) + : []; if (reasonInput == null) return; final reason = reasonInput.single.isEmpty ? null : reasonInput.single; for (final event in selectedEvents) {