From b0354c7423a65a50f029eb62b4e0a5517f751366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bot=20of=20Thomas=20G=C3=BCttler?= Date: Thu, 4 Jun 2026 06:15:55 +0200 Subject: [PATCH] fix: remove delete confirmation dialog from thread view (#402) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Removes the `AlertDialog` popup that appeared when tapping delete in thread view - Deletion now happens immediately, matching the behaviour of the single mail view - The existing `UndoShell` widget already listens for new `UndoAction` pushes and shows a snack bar with an **Undo** button — no extra UI code needed Closes #398 Co-authored-by: Thomas SharedInbox Reviewed-on: https://codeberg.org/guettli/sharedinbox/pulls/402 --- lib/ui/screens/thread_detail_screen.dart | 58 ++++++++---------------- 1 file changed, 19 insertions(+), 39 deletions(-) diff --git a/lib/ui/screens/thread_detail_screen.dart b/lib/ui/screens/thread_detail_screen.dart index 717a4b7..ef59980 100644 --- a/lib/ui/screens/thread_detail_screen.dart +++ b/lib/ui/screens/thread_detail_screen.dart @@ -297,47 +297,27 @@ class _EmailMessageCardState extends ConsumerState<_EmailMessageCard> { } Future _delete() async { - final confirmed = await showDialog( - context: context, - builder: (ctx) => AlertDialog( - title: const Text('Delete email'), - content: const Text('Move this email to Trash?'), - actions: [ - TextButton( - onPressed: () => Navigator.pop(ctx, false), - child: const Text('Cancel'), - ), - TextButton( - onPressed: () => Navigator.pop(ctx, true), - child: const Text('Delete'), - ), - ], - ), - ); + final repo = ref.read(emailRepositoryProvider); + // Fetch data first for IMAP undo support + final original = await repo.getEmail(widget.email.id); + + final destPath = await repo.deleteEmail(widget.email.id); + if (!mounted) return; - if (confirmed == true) { - final repo = ref.read(emailRepositoryProvider); - // Fetch data first for IMAP undo support - final original = await repo.getEmail(widget.email.id); - - final destPath = await repo.deleteEmail(widget.email.id); - - if (!mounted) return; - if (original != null) { - unawaited( - ref.read(undoServiceProvider.notifier).pushAction( - UndoAction( - id: DateTime.now().toIso8601String(), - accountId: widget.email.accountId, - type: UndoType.delete, - emailIds: [widget.email.id], - sourceMailboxPath: widget.email.mailboxPath, - destinationMailboxPath: destPath, - originalEmails: [original], - ), + if (original != null) { + unawaited( + ref.read(undoServiceProvider.notifier).pushAction( + UndoAction( + id: DateTime.now().toIso8601String(), + accountId: widget.email.accountId, + type: UndoType.delete, + emailIds: [widget.email.id], + sourceMailboxPath: widget.email.mailboxPath, + destinationMailboxPath: destPath, + originalEmails: [original], ), - ); - } + ), + ); } } }