From 678a8d716cc21d20f780b58a490e575d9cf77893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 27 Nov 2026 23:57:34 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=201:1=20call=20line=20shows?= =?UTF-8?q?=20only=20the=20other=20side's=20sound;=20search=20in=20the=20c?= =?UTF-8?q?ommunity=20People=20column;=20=F0=9F=90=9B=20fix:=20offline=20n?= =?UTF-8?q?o=20longer=20hides=20you=20in=201:1=20calls=20(the=20peer=20nev?= =?UTF-8?q?er=20saw=20your=20call=20ring)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/chat.rs | 16 +++++++++++++++- crates/client/src/gui/sidebar.rs | 14 ++++++++++---- crates/server/src/call/user.rs | 13 +++++++++++-- crates/server/src/call/voice.rs | 4 ++-- crates/server/src/publish.rs | 8 ++++++-- 5 files changed, 44 insertions(+), 11 deletions(-) diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 252630c..a1852f2 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -145,6 +145,7 @@ pub struct Chat { pub(super) muted: HashSet, pub(super) message_input: Entity, pub(super) search_input: Entity, + pub(super) member_input: Entity, pub(super) community_search: Entity, pub(super) community_hits: Vec, pub(super) found: Option, @@ -336,6 +337,14 @@ impl Chat { ) .detach(); + let member_input = new_input("Find", window, cx); + cx.subscribe_in(&member_input, window, |_, _, event, _, cx| { + if matches!(event, InputEvent::Change) { + cx.notify(); + } + }) + .detach(); + let search_input = new_input("Find user", window, cx); cx.subscribe_in( &search_input, @@ -412,6 +421,7 @@ impl Chat { muted: HashSet::new(), message_input, search_input, + member_input, community_search, community_hits: vec![], found: None, @@ -1405,7 +1415,7 @@ impl Yumush { }, } })) - .children(members_column(entity, self, themed)), + .children(members_column(entity, self, themed, cx)), ), None => panel.child(empty_state(palette)), }, @@ -2779,6 +2789,7 @@ fn members_column( entity: &Entity, yumush: &Yumush, palette: Palette, + cx: &App, ) -> Option> { let chat = &yumush.chat; let community_id = chat.selected_community_id?; @@ -2789,9 +2800,11 @@ fn members_column( return None; } let voice = chat.voice_ids(community_id); + let query = search_text(&chat.member_input, cx); let members: Vec = chat .members .iter() + .filter(|member| member.user.username.to_lowercase().contains(&query)) .map(|member| MemberRow { user: member.user.clone(), rank: chat.rank_of(&member.user), @@ -2905,6 +2918,7 @@ fn members_column( .gap(px(space::LG)) .border_l_1() .border_color(palette.border) + .child(super::sidebar::input_box(&chat.member_input, palette)) .children(section("In call", in_call)) .children(section("Online", online)) .children(section("Offline", offline)), diff --git a/crates/client/src/gui/sidebar.rs b/crates/client/src/gui/sidebar.rs index 94c3a82..40870ef 100644 --- a/crates/client/src/gui/sidebar.rs +++ b/crates/client/src/gui/sidebar.rs @@ -170,7 +170,13 @@ impl Yumush { fn voice_chip(&self, entity: &Entity, community_id: Id, palette: Palette) -> AnyElement { let ids = self.chat.voice_ids(community_id); let t = palette.tokens; - let mut speakers = ids + let direct = self.is_direct(community_id); + let heard: Vec = ids + .iter() + .copied() + .filter(|id| !(direct && self.is_me(*id))) + .collect(); + let mut speakers = heard .iter() .filter(|id| self.chat.waves.speaking.contains(id)); let voice = match (speakers.next(), speakers.next()) { @@ -178,7 +184,7 @@ impl Yumush { (Some(_), Some(_)) => super::parts::Voice::Live(t.paper()), _ => super::parts::Voice::Quiet, }; - let total = self.chat.waves.total(ids); + let total = self.chat.waves.total(&heard); let own = self.chat.voice_community() == Some(community_id); let folded = self.chat.call_folded; let fold = entity.clone(); @@ -194,7 +200,7 @@ impl Yumush { .h(px(space::MD)) .child(super::parts::voice_line(total.as_ref(), voice, t)), ) - .when(!self.is_direct(community_id), |this| { + .when(!direct, |this| { this.child( div() .text_size(text(text::CAPTION)) @@ -202,7 +208,7 @@ impl Yumush { .child(ids.len().to_string()), ) }) - .when(own, |this| { + .when(own && !direct, |this| { this.child( div() .id(format!("call_fold_{community_id}")) diff --git a/crates/server/src/call/user.rs b/crates/server/src/call/user.rs index c79d762..699290a 100644 --- a/crates/server/src/call/user.rs +++ b/crates/server/src/call/user.rs @@ -67,13 +67,22 @@ impl Handle for UpdateHue { impl Handle for UpdatePresence { async fn handle(self, me: Me, cx: &mut Cx<'_>) -> Result<(), ServerError> { let me = me.user()?; - let was_hidden = crate::publish::hidden(me.id, cx.db).await; + let was_offline = db::user::presence(me.id, cx.db).await? == Presence::Offline; db::user::update_presence(me.id, self.presence, cx.db).await?; cx.out .extend(presence_changed(&cx.sh.services.hub, me.id, cx.db).await?); let hiding = self.presence == Presence::Offline; let rooms = &cx.sh.services.rooms; - if let Some(community_id) = rooms.room_of(me.id).filter(|_| was_hidden != hiding) + let direct = match rooms.room_of(me.id) { + Some(community_id) => matches!( + db::community::kind_of(community_id, cx.db).await?, + Some(db::community::Kind::Direct) + ), + None => false, + }; + if let Some(community_id) = rooms + .room_of(me.id) + .filter(|_| was_offline != hiding && !direct) && rooms.participants(community_id).contains(&me.id) { let shares = rooms diff --git a/crates/server/src/call/voice.rs b/crates/server/src/call/voice.rs index 20ecf79..3124a1a 100644 --- a/crates/server/src/call/voice.rs +++ b/crates/server/src/call/voice.rs @@ -118,7 +118,7 @@ impl Handle for ListShares { let inside = rooms.room_of(me.id) == Some(self.community_id); let mut shares = Vec::new(); for share in rooms.shares(self.community_id) { - if inside || !crate::publish::hidden(share.user_id, cx.db).await { + if inside || !crate::publish::hidden(share.user_id, self.community_id, cx.db).await { shares.push(share); } } @@ -221,7 +221,7 @@ impl Handle for ListVoiceParticipants { let inside = rooms.room_of(me.id) == Some(self.community_id); let mut ids = Vec::new(); for user_id in rooms.participants(self.community_id) { - if inside || !crate::publish::hidden(user_id, cx.db).await { + if inside || !crate::publish::hidden(user_id, self.community_id, cx.db).await { ids.push(user_id); } } diff --git a/crates/server/src/publish.rs b/crates/server/src/publish.rs index 7bb48e7..6456ab3 100644 --- a/crates/server/src/publish.rs +++ b/crates/server/src/publish.rs @@ -59,7 +59,7 @@ pub(crate) async fn publish(shared: &Shared, db: &Connection, broadcasts: Vec
Result bool { +pub(crate) async fn hidden(user_id: Id, community_id: Id, db: &Connection) -> bool { matches!(db::user::presence(user_id, db).await, Ok(Presence::Offline)) + && !matches!( + db::community::kind_of(community_id, db).await, + Ok(Some(db::community::Kind::Direct)) + ) } fn voice_subject(down: &Down) -> Option<(Id, Id)> {