mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-25 07:55:56 +00:00
Automatically follow host when joining a project
This commit is contained in:
parent
225536accc
commit
8f88803695
1 changed files with 18 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
sidebar::{Side, ToggleSidebarItem},
|
sidebar::{Side, ToggleSidebarItem},
|
||||||
AppState,
|
AppState, ToggleFollow,
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use client::{proto, Client, Contact};
|
use client::{proto, Client, Contact};
|
||||||
|
@ -96,8 +96,11 @@ impl WaitingRoom {
|
||||||
match project {
|
match project {
|
||||||
Ok(project) => {
|
Ok(project) => {
|
||||||
cx.replace_root_view(|cx| {
|
cx.replace_root_view(|cx| {
|
||||||
let mut workspace =
|
let mut workspace = (app_state.build_workspace)(
|
||||||
(app_state.build_workspace)(project, &app_state, cx);
|
project.clone(),
|
||||||
|
&app_state,
|
||||||
|
cx,
|
||||||
|
);
|
||||||
workspace.toggle_sidebar_item(
|
workspace.toggle_sidebar_item(
|
||||||
&ToggleSidebarItem {
|
&ToggleSidebarItem {
|
||||||
side: Side::Left,
|
side: Side::Left,
|
||||||
|
@ -105,6 +108,18 @@ impl WaitingRoom {
|
||||||
},
|
},
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
if let Some((host_peer_id, _)) = project
|
||||||
|
.read(cx)
|
||||||
|
.collaborators()
|
||||||
|
.iter()
|
||||||
|
.find(|(_, collaborator)| collaborator.replica_id == 0)
|
||||||
|
{
|
||||||
|
if let Some(follow) = workspace
|
||||||
|
.toggle_follow(&ToggleFollow(*host_peer_id), cx)
|
||||||
|
{
|
||||||
|
follow.detach_and_log_err(cx);
|
||||||
|
}
|
||||||
|
}
|
||||||
workspace
|
workspace
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue