mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-13 05:42:59 +00:00
Fix integration tests
This commit is contained in:
parent
d8ea220acc
commit
ae9fb65315
2 changed files with 32 additions and 30 deletions
|
@ -243,6 +243,7 @@ impl Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drop(state);
|
||||||
for worktree_id in worktree_ids {
|
for worktree_id in worktree_ids {
|
||||||
self.close_worktree(worktree_id, connection_id).await?;
|
self.close_worktree(worktree_id, connection_id).await?;
|
||||||
}
|
}
|
||||||
|
@ -455,6 +456,7 @@ impl Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drop(state);
|
||||||
broadcast(request.sender_id, connection_ids, |conn_id| {
|
broadcast(request.sender_id, connection_ids, |conn_id| {
|
||||||
self.peer.send(
|
self.peer.send(
|
||||||
conn_id,
|
conn_id,
|
||||||
|
@ -485,7 +487,7 @@ impl Server {
|
||||||
async fn close_worktree(
|
async fn close_worktree(
|
||||||
self: &Arc<Server>,
|
self: &Arc<Server>,
|
||||||
worktree_id: u64,
|
worktree_id: u64,
|
||||||
conn_id: ConnectionId,
|
sender_conn_id: ConnectionId,
|
||||||
) -> tide::Result<()> {
|
) -> tide::Result<()> {
|
||||||
let connection_ids;
|
let connection_ids;
|
||||||
let mut user_ids;
|
let mut user_ids;
|
||||||
|
@ -494,17 +496,17 @@ impl Server {
|
||||||
let mut is_guest = false;
|
let mut is_guest = false;
|
||||||
{
|
{
|
||||||
let mut state = self.state.write().await;
|
let mut state = self.state.write().await;
|
||||||
let worktree = state.write_worktree(worktree_id, conn_id)?;
|
let worktree = state.write_worktree(worktree_id, sender_conn_id)?;
|
||||||
let host_connection_id = worktree.host_connection_id;
|
let host_connection_id = worktree.host_connection_id;
|
||||||
connection_ids = worktree.connection_ids();
|
connection_ids = worktree.connection_ids();
|
||||||
user_ids = worktree.collaborator_user_ids.clone();
|
user_ids = worktree.collaborator_user_ids.clone();
|
||||||
|
|
||||||
if worktree.host_connection_id == conn_id {
|
if worktree.host_connection_id == sender_conn_id {
|
||||||
is_host = true;
|
is_host = true;
|
||||||
state.remove_worktree(worktree_id);
|
state.remove_worktree(worktree_id);
|
||||||
} else {
|
} else {
|
||||||
let share = worktree.share_mut()?;
|
let share = worktree.share_mut()?;
|
||||||
if let Some(replica_id) = share.guest_connection_ids.remove(&conn_id) {
|
if let Some(replica_id) = share.guest_connection_ids.remove(&sender_conn_id) {
|
||||||
is_guest = true;
|
is_guest = true;
|
||||||
share.active_replica_ids.remove(&replica_id);
|
share.active_replica_ids.remove(&replica_id);
|
||||||
}
|
}
|
||||||
|
@ -514,18 +516,18 @@ impl Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_host {
|
if is_host {
|
||||||
broadcast(conn_id, connection_ids, |conn_id| {
|
broadcast(sender_conn_id, connection_ids, |conn_id| {
|
||||||
self.peer
|
self.peer
|
||||||
.send(conn_id, proto::UnshareWorktree { worktree_id })
|
.send(conn_id, proto::UnshareWorktree { worktree_id })
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
} else if is_guest {
|
} else if is_guest {
|
||||||
broadcast(conn_id, connection_ids, |conn_id| {
|
broadcast(sender_conn_id, connection_ids, |conn_id| {
|
||||||
self.peer.send(
|
self.peer.send(
|
||||||
conn_id,
|
conn_id,
|
||||||
proto::RemovePeer {
|
proto::RemovePeer {
|
||||||
worktree_id,
|
worktree_id,
|
||||||
peer_id: conn_id.0,
|
peer_id: sender_conn_id.0,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -68,31 +68,31 @@ impl Presence {
|
||||||
let rpc = self.rpc.clone();
|
let rpc = self.rpc.clone();
|
||||||
let user_store = self.user_store.clone();
|
let user_store = self.user_store.clone();
|
||||||
async move {
|
async move {
|
||||||
let response = rpc.request(proto::GetCollaborators {}).await?;
|
// let response = rpc.request(proto::GetCollaborators {}).await?;
|
||||||
let mut user_ids = HashSet::new();
|
// let mut user_ids = HashSet::new();
|
||||||
for collaborator in &response.collaborators {
|
// for collaborator in &response.collaborators {
|
||||||
user_ids.insert(collaborator.user_id);
|
// user_ids.insert(collaborator.user_id);
|
||||||
user_ids.extend(
|
// user_ids.extend(
|
||||||
collaborator
|
// collaborator
|
||||||
.worktrees
|
// .worktrees
|
||||||
.iter()
|
// .iter()
|
||||||
.flat_map(|w| &w.participants)
|
// .flat_map(|w| &w.participants)
|
||||||
.copied(),
|
// .copied(),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
user_store
|
// user_store
|
||||||
.load_users(user_ids.into_iter().collect())
|
// .load_users(user_ids.into_iter().collect())
|
||||||
.await?;
|
// .await?;
|
||||||
|
|
||||||
let mut collaborators = Vec::new();
|
// let mut collaborators = Vec::new();
|
||||||
for collaborator in response.collaborators {
|
// for collaborator in response.collaborators {
|
||||||
collaborators.push(Collaborator::from_proto(collaborator, &user_store).await?);
|
// collaborators.push(Collaborator::from_proto(collaborator, &user_store).await?);
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.update(&mut cx, |this, cx| {
|
// this.update(&mut cx, |this, cx| {
|
||||||
this.collaborators = collaborators;
|
// this.collaborators = collaborators;
|
||||||
cx.notify();
|
// cx.notify();
|
||||||
});
|
// });
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue