Start work on requesting to join projects

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-05-12 17:24:00 -07:00
parent e199b7e50e
commit be51a58311
25 changed files with 660 additions and 883 deletions

View file

@ -1106,7 +1106,7 @@ mod tests {
let (done_tx1, mut done_rx1) = smol::channel::unbounded();
let (done_tx2, mut done_rx2) = smol::channel::unbounded();
client.add_model_message_handler(
move |model: ModelHandle<Model>, _: TypedEnvelope<proto::UnshareProject>, _, cx| {
move |model: ModelHandle<Model>, _: TypedEnvelope<proto::JoinProject>, _, cx| {
match model.read_with(&cx, |model, _| model.id) {
1 => done_tx1.try_send(()).unwrap(),
2 => done_tx2.try_send(()).unwrap(),
@ -1135,8 +1135,8 @@ mod tests {
let subscription3 = model3.update(cx, |_, cx| client.add_model_for_remote_entity(3, cx));
drop(subscription3);
server.send(proto::UnshareProject { project_id: 1 });
server.send(proto::UnshareProject { project_id: 2 });
server.send(proto::JoinProject { project_id: 1 });
server.send(proto::JoinProject { project_id: 2 });
done_rx1.next().await.unwrap();
done_rx2.next().await.unwrap();
}

View file

@ -17,6 +17,12 @@ pub struct User {
pub avatar: Option<Arc<ImageData>>,
}
impl PartialEq for User {
fn eq(&self, other: &Self) -> bool {
self.id == other.id && self.github_login == other.github_login
}
}
#[derive(Debug)]
pub struct Contact {
pub user: Arc<User>,
@ -27,7 +33,6 @@ pub struct Contact {
#[derive(Debug)]
pub struct ProjectMetadata {
pub id: u64,
pub is_shared: bool,
pub worktree_root_names: Vec<String>,
pub guests: Vec<Arc<User>>,
}
@ -560,7 +565,6 @@ impl Contact {
projects.push(ProjectMetadata {
id: project.id,
worktree_root_names: project.worktree_root_names.clone(),
is_shared: project.is_shared,
guests,
});
}