From 7d798c57704cc38a39df3cd21be17d8ae52230b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Wed, 18 Jun 2025 09:07:22 +0200 Subject: [PATCH] fix: Route back to room list after leaving a chat --- lib/widgets/chat_settings_popup_menu.dart | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/widgets/chat_settings_popup_menu.dart b/lib/widgets/chat_settings_popup_menu.dart index 3978d5e99..069f21da4 100644 --- a/lib/widgets/chat_settings_popup_menu.dart +++ b/lib/widgets/chat_settings_popup_menu.dart @@ -56,6 +56,7 @@ class ChatSettingsPopupMenuState extends State { onSelected: (choice) async { switch (choice) { case ChatPopupMenuActions.leave: + final router = GoRouter.of(context); final confirmed = await showOkCancelAlertDialog( context: context, title: L10n.of(context).areYouSure, @@ -64,15 +65,15 @@ class ChatSettingsPopupMenuState extends State { cancelLabel: L10n.of(context).cancel, isDestructive: true, ); - if (confirmed == OkCancelResult.ok) { - final success = await showFutureLoadingDialog( - context: context, - future: () => widget.room.leave(), - ); - if (success.error == null) { - context.go('/rooms'); - } + if (confirmed != OkCancelResult.ok) return; + final result = await showFutureLoadingDialog( + context: context, + future: () => widget.room.leave(), + ); + if (result.error == null) { + router.go('/rooms'); } + break; case ChatPopupMenuActions.mute: await showFutureLoadingDialog(