From ae0b7cae37fd347e6f3b35fd5809fa2f74b03efb Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Thu, 25 Jun 2026 16:05:56 -0400 Subject: [PATCH] Fix navigating to Collab URLs not working when not connected (#59652) # Objective - Fix collab channel links opened from URL actions or the CLI when Zed is signed in but not currently connected to the collab server. ## Solution - Connect to collab before handling channel joins or channel notes links. - Keep downstream errors visible if connecting or opening still fails. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed opening collab links when Zed is not already connected to the collaboration server. --- crates/zed/src/main.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index b23f0774ad..f196153aed 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -67,11 +67,13 @@ use std::{ }; use theme::{ActiveTheme, GlobalTheme, ThemeRegistry}; use theme_settings::load_user_theme; -use util::{ResultExt, TryFutureExt, maybe}; +use util::{ResultExt, maybe}; use uuid::Uuid; use workspace::{ AppState, MultiWorkspace, SerializedWorkspaceLocation, SessionWorkspace, Toast, - WorkspaceSettings, WorkspaceStore, notifications::NotificationId, restore_multiworkspace, + WorkspaceSettings, WorkspaceStore, + notifications::{NotificationId, NotifyResultExt}, + restore_multiworkspace, }; use zed::{ OpenListener, OpenRequest, RawOpenRequest, app_menus, build_window_options, @@ -1391,9 +1393,9 @@ fn handle_open_request(request: OpenRequest, app_state: Arc, cx: &mut task.await?; } let client = app_state.client.clone(); - // we continue even if authentication fails as join_channel/ open channel notes will + // we continue even if connection fails as join_channel/ open channel notes will // show a visible error message. - authenticate(client, cx).await.log_err(); + client.connect(true, cx).await.into_response().log_err(); if let Some(channel_id) = request.join_channel { cx.update(|cx| { @@ -1412,6 +1414,7 @@ fn handle_open_request(request: OpenRequest, app_state: Arc, cx: &mut workspace::get_any_active_multi_workspace(app_state, cx.clone()).await?; let workspace = workspace_window.read_with(cx, |mw, _| mw.workspace().clone())?; + let weak_workspace = workspace.downgrade(); let mut promises = Vec::new(); for (channel_id, heading) in request.open_channel_notes { @@ -1423,10 +1426,11 @@ fn handle_open_request(request: OpenRequest, app_state: Arc, cx: &mut window, cx, ) - .log_err() })?) } - future::join_all(promises).await; + for result in future::join_all(promises).await { + result.notify_workspace_async_err(weak_workspace.clone(), cx); + } anyhow::Ok(()) }) .await;