diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index c84af7c9f8..3dc573a8a3 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -45,7 +45,7 @@ pub struct Contact { #[derive(Clone, Debug, PartialEq)] pub struct ProjectMetadata { pub id: u64, - pub worktree_root_names: Vec, + pub visible_worktree_root_names: Vec, pub guests: BTreeSet>, } @@ -634,7 +634,7 @@ impl Contact { } projects.push(ProjectMetadata { id: project.id, - worktree_root_names: project.worktree_root_names.clone(), + visible_worktree_root_names: project.visible_worktree_root_names.clone(), guests, }); } @@ -648,7 +648,7 @@ impl Contact { pub fn non_empty_projects(&self) -> impl Iterator { self.projects .iter() - .filter(|project| !project.worktree_root_names.is_empty()) + .filter(|project| !project.visible_worktree_root_names.is_empty()) } } diff --git a/crates/collab/src/integration_tests.rs b/crates/collab/src/integration_tests.rs index cf9e7ec8a7..dd4b85731a 100644 --- a/crates/collab/src/integration_tests.rs +++ b/crates/collab/src/integration_tests.rs @@ -608,7 +608,7 @@ async fn test_offline_projects( store.contacts()[0].projects, &[ProjectMetadata { id: project_id, - worktree_root_names: vec!["crate1".into(), "crate2".into()], + visible_worktree_root_names: vec!["crate1".into(), "crate2".into()], guests: Default::default(), }] ); @@ -637,7 +637,7 @@ async fn test_offline_projects( store.contacts()[0].projects, &[ProjectMetadata { id: project_id, - worktree_root_names: vec!["crate1".into(), "crate2".into()], + visible_worktree_root_names: vec!["crate1".into(), "crate2".into()], guests: Default::default(), }] ); @@ -655,7 +655,11 @@ async fn test_offline_projects( store.contacts()[0].projects, &[ProjectMetadata { id: project_id, - worktree_root_names: vec!["crate1".into(), "crate2".into(), "crate3".into()], + visible_worktree_root_names: vec![ + "crate1".into(), + "crate2".into(), + "crate3".into() + ], guests: Default::default(), }] ); @@ -695,12 +699,16 @@ async fn test_offline_projects( &[ ProjectMetadata { id: project_id, - worktree_root_names: vec!["crate1".into(), "crate2".into(), "crate3".into()], + visible_worktree_root_names: vec![ + "crate1".into(), + "crate2".into(), + "crate3".into() + ], guests: Default::default(), }, ProjectMetadata { id: project2_id, - worktree_root_names: vec!["crate3".into()], + visible_worktree_root_names: vec!["crate3".into()], guests: Default::default(), } ] @@ -3515,7 +3523,7 @@ async fn test_contacts( .iter() .map(|p| { ( - p.worktree_root_names[0].as_str(), + p.visible_worktree_root_names[0].as_str(), p.guests.iter().map(|p| p.github_login.as_str()).collect(), ) }) diff --git a/crates/collab/src/rpc/store.rs b/crates/collab/src/rpc/store.rs index 857f351517..d929078dc5 100644 --- a/crates/collab/src/rpc/store.rs +++ b/crates/collab/src/rpc/store.rs @@ -277,9 +277,10 @@ impl Store { if project.host_user_id == user_id { metadata.push(proto::ProjectMetadata { id: project_id, - worktree_root_names: project + visible_worktree_root_names: project .worktrees .values() + .filter(|worktree| worktree.visible) .map(|worktree| worktree.root_name.clone()) .collect(), guests: project diff --git a/crates/contacts_panel/src/contacts_panel.rs b/crates/contacts_panel/src/contacts_panel.rs index e1838f9a1c..a21a9d98ab 100644 --- a/crates/contacts_panel/src/contacts_panel.rs +++ b/crates/contacts_panel/src/contacts_panel.rs @@ -462,7 +462,7 @@ impl ContactsPanel { ) .with_child( Label::new( - project.worktree_root_names.join(", "), + project.visible_worktree_root_names.join(", "), row.name.text.clone(), ) .aligned() @@ -847,7 +847,7 @@ impl ContactsPanel { p.read(cx).remote_id() == Some(project.id) }) .map(|ix| open_projects.remove(ix).downgrade()); - if project.worktree_root_names.is_empty() { + if project.visible_worktree_root_names.is_empty() { None } else { Some(ContactEntry::ContactProject( @@ -872,7 +872,7 @@ impl ContactsPanel { self.entries.extend( contact.projects.iter().enumerate().filter_map( |(ix, project)| { - if project.worktree_root_names.is_empty() { + if project.visible_worktree_root_names.is_empty() { None } else { Some(ContactEntry::ContactProject( @@ -1295,7 +1295,7 @@ mod tests { should_notify: false, projects: vec![proto::ProjectMetadata { id: 101, - worktree_root_names: vec!["dir1".to_string()], + visible_worktree_root_names: vec!["dir1".to_string()], guests: vec![2], }], }, @@ -1305,7 +1305,7 @@ mod tests { should_notify: false, projects: vec![proto::ProjectMetadata { id: 102, - worktree_root_names: vec!["dir2".to_string()], + visible_worktree_root_names: vec!["dir2".to_string()], guests: vec![2], }], }, @@ -1321,7 +1321,7 @@ mod tests { should_notify: false, projects: vec![proto::ProjectMetadata { id: 103, - worktree_root_names: vec!["dir3".to_string()], + visible_worktree_root_names: vec!["dir3".to_string()], guests: vec![3], }], }, @@ -1425,12 +1425,12 @@ mod tests { projects: vec![ proto::ProjectMetadata { id: 103, - worktree_root_names: vec!["dir3".to_string()], + visible_worktree_root_names: vec!["dir3".to_string()], guests: vec![3], }, proto::ProjectMetadata { id: 200, - worktree_root_names: vec!["private_dir".to_string()], + visible_worktree_root_names: vec!["private_dir".to_string()], guests: vec![3], }, ], @@ -1489,7 +1489,7 @@ mod tests { should_notify: false, projects: vec![proto::ProjectMetadata { id: 103, - worktree_root_names: vec!["dir3".to_string()], + visible_worktree_root_names: vec!["dir3".to_string()], guests: vec![3], }], }], @@ -1611,7 +1611,9 @@ mod tests { .map(|project| project.read(cx)); format!( " {}{}", - contact.projects[*project_ix].worktree_root_names.join(", "), + contact.projects[*project_ix] + .visible_worktree_root_names + .join(", "), if project.map_or(true, |project| project.is_online()) { "" } else { diff --git a/crates/rpc/proto/zed.proto b/crates/rpc/proto/zed.proto index 7bece4c93c..ff52fb9e8d 100644 --- a/crates/rpc/proto/zed.proto +++ b/crates/rpc/proto/zed.proto @@ -946,7 +946,7 @@ message Contact { message ProjectMetadata { uint64 id = 1; - repeated string worktree_root_names = 3; + repeated string visible_worktree_root_names = 3; repeated uint64 guests = 4; } diff --git a/crates/workspace/src/waiting_room.rs b/crates/workspace/src/waiting_room.rs index c3d1e3c7e6..5052afcf50 100644 --- a/crates/workspace/src/waiting_room.rs +++ b/crates/workspace/src/waiting_room.rs @@ -137,7 +137,7 @@ impl WaitingRoom { login, humanize_list( &contact.projects[project_index] - .worktree_root_names + .visible_worktree_root_names ) ) } @@ -166,7 +166,7 @@ impl WaitingRoom { message: format!( "Asking to join @{}'s copy of {}...", contact.user.github_login, - humanize_list(&contact.projects[project_index].worktree_root_names) + humanize_list(&contact.projects[project_index].visible_worktree_root_names) ), waiting: true, client,