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.
This commit is contained in:
1 parent
f8d286c2a7
commit
ae0b7cae37
1 file changed
+10
-6
+10
-6
@@ -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<AppState>, 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<AppState>, 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<AppState>, 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;
|
||||
|
||||
Reference in new issue
Block a user