From 6daa803a5e8a287f910880b6f0635b8242d37715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Tue, 21 Nov 2023 10:50:48 +0100 Subject: [PATCH] join-room-dialog: Fix action when dialog closes --- src/session/view/join_room_dialog.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/session/view/join_room_dialog.rs b/src/session/view/join_room_dialog.rs index 6224d0d0..a3f51fc9 100644 --- a/src/session/view/join_room_dialog.rs +++ b/src/session/view/join_room_dialog.rs @@ -156,19 +156,18 @@ impl JoinRoomDialog { let Some(session) = self.session() else { return; }; + let Some(window) = self.transient_for().and_downcast::() else { + return; + }; let room_list = session.room_list(); // Join or view the room with the given identifier. if let Some(room) = room_list.joined_room((&*room_id).into()) { - let Some(window) = self.root().and_downcast::() else { - return; - }; - window.session_view().select_room(Some(room)); } else { - spawn!(clone!(@weak self as obj, @weak room_list => async move { + spawn!(clone!(@weak window, @weak room_list => async move { if let Err(error) = room_list.join_by_id_or_alias(room_id, via).await { - toast!(obj, error); + toast!(window, error); } })); }