From a72cea7b5b32b66cc800f63fbf291ff42b3e7832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 29 Nov 2026 06:55:01 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20clicking=20the=20open=20c?= =?UTF-8?q?hat=20reloaded=20it;=20select=5Fcommunity=20is=20the=20single?= =?UTF-8?q?=20entry=20and=20returns=20early=20when=20that=20chat=20is=20al?= =?UTF-8?q?ready=20shown=20(also=20switches=20to=20the=20chat=20view=20its?= =?UTF-8?q?elf)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/builder/communities.rs | 7 ++----- crates/client/src/gui/chat.rs | 4 ++++ crates/client/src/gui/dock.rs | 4 ++-- crates/client/src/gui/jump.rs | 5 +---- crates/client/src/gui/share_view.rs | 1 - crates/client/src/gui/sidebar.rs | 13 ------------- 6 files changed, 9 insertions(+), 25 deletions(-) diff --git a/crates/client/src/gui/builder/communities.rs b/crates/client/src/gui/builder/communities.rs index c531edb..d0657f0 100644 --- a/crates/client/src/gui/builder/communities.rs +++ b/crates/client/src/gui/builder/communities.rs @@ -16,9 +16,7 @@ use super::{ ui::{card, confirmed, icon_button, list_row, pill, rows_body}, }; use crate::gui::{ - Palette, Yumush, avatar, - chat::View, - community_icon, entity_action, notify_error, + Palette, Yumush, avatar, community_icon, entity_action, notify_error, parts::{self, Press}, profile::user_link, style::{radius, size, space, text}, @@ -251,7 +249,7 @@ impl Yumush { ) { let community_id = community.id; if self.chat.joined(community_id) { - self.go_to_community(community_id, window, cx); + self.select_community(community_id, window, cx); } else { self.open_builder_community(community, window, cx); } @@ -270,7 +268,6 @@ impl Yumush { if !self.chat.joined(community_id) { self.chat.opened = Some(community); } - self.show_view(View::Chat, window, cx); self.select_community(community_id, window, cx); } diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 8fd48d5..bd55e97 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -2010,6 +2010,10 @@ impl Yumush { window: &mut Window, cx: &mut Context, ) { + if self.chat.view == View::Chat && self.chat.is_selected(community_id) { + return; + } + self.show_view(View::Chat, window, cx); self.stop_playing(cx); self.save_draft(cx); self.chat.select(Some(community_id)); diff --git a/crates/client/src/gui/dock.rs b/crates/client/src/gui/dock.rs index ff7a7d9..d93d996 100644 --- a/crates/client/src/gui/dock.rs +++ b/crates/client/src/gui/dock.rs @@ -62,7 +62,7 @@ impl Yumush { let go_id = community.id; let actions = CallActions { go: Rc::new(entity_action(entity, move |yumush, window, cx| { - yumush.go_to_community(go_id, window, cx); + yumush.select_community(go_id, window, cx); })), mute: Rc::new(entity_action(entity, |yumush, window, cx| { yumush.toggle_mute(window, cx) @@ -81,7 +81,7 @@ impl Yumush { cx.notify(); })), stats: Rc::new(entity_action(entity, move |yumush, window, cx| { - yumush.go_to_community(go_id, window, cx); + yumush.select_community(go_id, window, cx); yumush.toggle_stats(super::chat::StatsAt::Dock); cx.notify(); })), diff --git a/crates/client/src/gui/jump.rs b/crates/client/src/gui/jump.rs index bd11041..128a089 100644 --- a/crates/client/src/gui/jump.rs +++ b/crates/client/src/gui/jump.rs @@ -399,10 +399,7 @@ impl Yumush { fn go_place(&mut self, place: Place, window: &mut Window, cx: &mut Context) { match place { - Place::Room(id) => { - self.show_view(View::Chat, window, cx); - self.select_community(id, window, cx); - } + Place::Room(id) => self.select_community(id, window, cx), Place::Person(id) => { self.show_view(View::Chat, window, cx); self.open_direct(id, window, cx); diff --git a/crates/client/src/gui/share_view.rs b/crates/client/src/gui/share_view.rs index d40d1f9..a141202 100644 --- a/crates/client/src/gui/share_view.rs +++ b/crates/client/src/gui/share_view.rs @@ -683,7 +683,6 @@ impl Yumush { if std::mem::take(&mut yumush.chat.float.moved) { return; } - yumush.chat.view = View::Chat; yumush.select_community(community, window, cx); }) }) diff --git a/crates/client/src/gui/sidebar.rs b/crates/client/src/gui/sidebar.rs index 4f91ede..6da4725 100644 --- a/crates/client/src/gui/sidebar.rs +++ b/crates/client/src/gui/sidebar.rs @@ -263,19 +263,6 @@ impl Yumush { .into_any_element() } - pub(super) fn go_to_community( - &mut self, - community_id: Id, - window: &mut Window, - cx: &mut Context, - ) { - if self.chat.view == View::Chat && self.chat.is_selected(community_id) { - return; - } - self.show_view(View::Chat, window, cx); - self.select_community(community_id, window, cx); - } - pub(super) fn new_community(&mut self, window: &mut Window, cx: &mut Context) { input_dialog( w().sidebar.new_community,