BlueGit

ict rusty-teams

fix(call): an accepted 1:1 call shows the chat button

- The 1:1 ring push carries no thread id, so the call had no chat
- Fall back to the 1:1 chat with the caller, as missed calls already do

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-25 · 6 days ago

Hash
7f664bf8daac4c26d27f387f04e9d75555f474ad
Parent
414be8e2
1 file changed +34 −13
crates/app-state/src/call/actions.rs +34 −13
@@ -1337,7 +1337,11 @@ impl AppState {
1337 1337 let _ = held.commands.send(CallCommand::Hangup);
1338 1338 }
1339 1339 self.signal_ring(ring_id, RingSignal::Accept, cx);
1340 let conversation_id = entry.ring.thread_id.clone();
1340 let conversation_id = entry.ring.thread_id.clone().or_else(|| {
1341 (!entry.ring.is_group)
1342 .then(|| self.one_on_one_chat_with_mri(&entry.ring.caller.mri))
1343 .flatten()
1344 });
1341 1345 let title = conversation_id
1342 1346 .as_deref()
1343 1347 .and_then(|id| self.sidebar.chats.iter().find(|chat| chat.id == id))
@@ -1389,18 +1393,11 @@ impl AppState {
1389 1393 {
1390 1394 return Some(thread_id.clone());
1391 1395 }
1392 let user_id = missed.caller_mri.strip_prefix(ORGID_PREFIX)?;
1393 self.sidebar
1394 .chats
1395 .iter()
1396 .find(|chat| {
1397 crate::data::is_one_on_one(chat)
1398 && chat
1399 .members
1400 .iter()
1401 .any(|member| member.user_id.as_deref() == Some(user_id))
1402 })
1403 .map(|chat| chat.id.clone())
1396 self.one_on_one_chat_with_mri(&missed.caller_mri)
1397 }
1398
1399 fn one_on_one_chat_with_mri(&self, mri: &str) -> Option<String> {
1400 self.one_on_one_chat_with(mri.strip_prefix(ORGID_PREFIX)?)
1404 1401 }
1405 1402 }
1406 1403
@@ -2791,6 +2788,30 @@ mod tests {
2791 2788 });
2792 2789 }
2793 2790
2791 #[gpui_kit::test]
2792 fn an_accepted_one_on_one_ring_gets_the_chat_with_the_caller(cx: &mut TestAppContext) {
2793 let app = app_with_chats(cx);
2794 cx.update(|cx| {
2795 app.update(cx, |state, cx| {
2796 let ring = calling::IncomingRing {
2797 caller: calling::Caller {
2798 mri: "8:orgid:bea-id".into(),
2799 display_name: "Bea".into(),
2800 },
2801 thread_id: None,
2802 ..demo_ring()
2803 };
2804 let ring_id = ring.ring_id;
2805 state.push_ring(ring, true, cx);
2806 state.accept_ring(ring_id, calling::AcceptMode::Audio, cx);
2807 assert_eq!(
2808 state.call.as_ref().unwrap().chat_thread(),
2809 Some("19:dm@unq.gbl.spaces")
2810 );
2811 })
2812 });
2813 }
2814
2794 2815 #[gpui_kit::test]
2795 2816 fn only_meeting_chats_and_channels_watch_for_a_running_meeting(cx: &mut TestAppContext) {
2796 2817 let app = app_with_chats(cx);
@@ -1337,7 +1337,11 @@ impl AppState {
1337 let _ = held.commands.send(CallCommand::Hangup);
1337 let _ = held.commands.send(CallCommand::Hangup);
1338 }
1338 }
1339 self.signal_ring(ring_id, RingSignal::Accept, cx);
1339 self.signal_ring(ring_id, RingSignal::Accept, cx);
1340 let conversation_id = entry.ring.thread_id.clone();
1340 let conversation_id = entry.ring.thread_id.clone().or_else(|| {
1341 (!entry.ring.is_group)
1342 .then(|| self.one_on_one_chat_with_mri(&entry.ring.caller.mri))
1343 .flatten()
1344 });
1341 let title = conversation_id
1345 let title = conversation_id
1342 .as_deref()
1346 .as_deref()
1343 .and_then(|id| self.sidebar.chats.iter().find(|chat| chat.id == id))
1347 .and_then(|id| self.sidebar.chats.iter().find(|chat| chat.id == id))
@@ -1389,18 +1393,11 @@ impl AppState {
1389 {
1393 {
1390 return Some(thread_id.clone());
1394 return Some(thread_id.clone());
1391 }
1395 }
1392 let user_id = missed.caller_mri.strip_prefix(ORGID_PREFIX)?;
1396 self.one_on_one_chat_with_mri(&missed.caller_mri)
1393 self.sidebar
1397 }
1394 .chats
1398
1395 .iter()
1399 fn one_on_one_chat_with_mri(&self, mri: &str) -> Option<String> {
1396 .find(|chat| {
1400 self.one_on_one_chat_with(mri.strip_prefix(ORGID_PREFIX)?)
1397 crate::data::is_one_on_one(chat)
1398 && chat
1399 .members
1400 .iter()
1401 .any(|member| member.user_id.as_deref() == Some(user_id))
1402 })
1403 .map(|chat| chat.id.clone())
1404 }
1401 }
1405}
1402}
1406
1403
@@ -2791,6 +2788,30 @@ mod tests {
2791 });
2788 });
2792 }
2789 }
2793
2790
2791 #[gpui_kit::test]
2792 fn an_accepted_one_on_one_ring_gets_the_chat_with_the_caller(cx: &mut TestAppContext) {
2793 let app = app_with_chats(cx);
2794 cx.update(|cx| {
2795 app.update(cx, |state, cx| {
2796 let ring = calling::IncomingRing {
2797 caller: calling::Caller {
2798 mri: "8:orgid:bea-id".into(),
2799 display_name: "Bea".into(),
2800 },
2801 thread_id: None,
2802 ..demo_ring()
2803 };
2804 let ring_id = ring.ring_id;
2805 state.push_ring(ring, true, cx);
2806 state.accept_ring(ring_id, calling::AcceptMode::Audio, cx);
2807 assert_eq!(
2808 state.call.as_ref().unwrap().chat_thread(),
2809 Some("19:dm@unq.gbl.spaces")
2810 );
2811 })
2812 });
2813 }
2814
2794 #[gpui_kit::test]
2815 #[gpui_kit::test]
2795 fn only_meeting_chats_and_channels_watch_for_a_running_meeting(cx: &mut TestAppContext) {
2816 fn only_meeting_chats_and_channels_watch_for_a_running_meeting(cx: &mut TestAppContext) {
2796 let app = app_with_chats(cx);
2817 let app = app_with_chats(cx);