From 8b749c83f5ab034d04388754e887a6925385cb96 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:16:13 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20going=20ghost=20stops=20y?= =?UTF-8?q?our=20camera=20and=20screen=20share=20first=20(the=20server=20d?= =?UTF-8?q?ropped=20them=20but=20capture=20kept=20running=20and=20the=20bu?= =?UTF-8?q?ttons=20stayed=20on),=20share=20buttons=20hidden=20while=20ghos?= =?UTF-8?q?t,=20a=20ghost's=20leave=20reaches=20their=20own=20client=20(st?= =?UTF-8?q?ale=20in-call=20count)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/builder.rs | 4 +++ crates/client/src/gui/call_bar.rs | 55 ++++++++++++++++--------------- crates/client/src/gui/dock.rs | 1 + crates/client/src/gui/gallery.rs | 1 + crates/server/src/request.rs | 5 +++ 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/crates/client/src/gui/builder.rs b/crates/client/src/gui/builder.rs index 400308e..3b2568a 100644 --- a/crates/client/src/gui/builder.rs +++ b/crates/client/src/gui/builder.rs @@ -448,6 +448,10 @@ impl Yumush { let network = self.network.clone(); cx.spawn_in(window, async move |this, cx| { + if enabled { + let _ = network.stop_share().await; + let _ = network.stop_camera().await; + } match network.call(SetGhost { enabled }).await { Ok(()) => { let _ = this.update(cx, |yumush, cx| { diff --git a/crates/client/src/gui/call_bar.rs b/crates/client/src/gui/call_bar.rs index 473277f..9ab28c8 100644 --- a/crates/client/src/gui/call_bar.rs +++ b/crates/client/src/gui/call_bar.rs @@ -25,6 +25,7 @@ pub struct CallBar { pub screen: bool, pub share: Option<(Option>, gpui_kit::Hsla)>, pub stats: bool, + pub ghost: bool, } pub struct CallActions { @@ -83,32 +84,34 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div { t, run(&actions.deafen), )) - .child(icon_button( - format!("bar_camera_{}", bar.camera), - IconName::Video, - if bar.camera { - "Turn off camera" - } else { - "Turn on camera" - }, - tone(bar.camera), - t, - run(&actions.camera), - )) - .child(actions.camera_more) - .child(icon_button( - format!("bar_screen_{}", bar.screen), - IconName::ScreenShare, - if bar.screen { - "Stop sharing" - } else { - "Share screen" - }, - tone(bar.screen), - t, - run(&actions.screen), - )) - .child(actions.screen_more) + .when(!bar.ghost, |row| { + row.child(icon_button( + format!("bar_camera_{}", bar.camera), + IconName::Video, + if bar.camera { + "Turn off camera" + } else { + "Turn on camera" + }, + tone(bar.camera), + t, + run(&actions.camera), + )) + .child(actions.camera_more) + .child(icon_button( + format!("bar_screen_{}", bar.screen), + IconName::ScreenShare, + if bar.screen { + "Stop sharing" + } else { + "Share screen" + }, + tone(bar.screen), + t, + run(&actions.screen), + )) + .child(actions.screen_more) + }) .child(icon_button( "bar_leave", IconName::PhoneOff, diff --git a/crates/client/src/gui/dock.rs b/crates/client/src/gui/dock.rs index 5ce4d83..24492b2 100644 --- a/crates/client/src/gui/dock.rs +++ b/crates/client/src/gui/dock.rs @@ -45,6 +45,7 @@ impl Yumush { deafened, camera: self.network.share_source(Kind::Camera).is_some(), screen: self.network.share_source(Kind::Screen).is_some(), + ghost: self.chat.ghost, share: self .network .share_source(Kind::Screen) diff --git a/crates/client/src/gui/gallery.rs b/crates/client/src/gui/gallery.rs index e09048a..09598b6 100644 --- a/crates/client/src/gui/gallery.rs +++ b/crates/client/src/gui/gallery.rs @@ -337,6 +337,7 @@ fn call_page(state: State, t: Tokens) -> impl IntoElement { screen: state == State::Many, share: (state == State::Many).then(|| (Some(bands(2.)), t.hue(Hue::Amber))), stats: false, + ghost: false, }; let none = || -> call_bar::Action { Rc::new(|_, _| {}) }; let actions = CallActions { diff --git a/crates/server/src/request.rs b/crates/server/src/request.rs index 83fdc4d..b1daa55 100644 --- a/crates/server/src/request.rs +++ b/crates/server/src/request.rs @@ -196,6 +196,11 @@ pub async fn departed( return Ok(broadcasts); }; record_ghost_voice(user_id, community_id, seconds, db).await?; + let event = Event::VoiceLeft { + community_id, + user_id, + }; + broadcasts.push(Broadcast::new(To::User(user_id), event)); Ok(broadcasts) }