Broadcast proto::UnregisterProject
when host closes a project
This commit is contained in:
parent
e4c73b24fd
commit
2af4bdef42
1 changed files with 21 additions and 0 deletions
|
@ -434,6 +434,19 @@ impl Server {
|
||||||
state.unregister_project(request.payload.project_id, request.sender_id)?;
|
state.unregister_project(request.payload.project_id, request.sender_id)?;
|
||||||
(state.user_id_for_connection(request.sender_id)?, project)
|
(state.user_id_for_connection(request.sender_id)?, project)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
broadcast(
|
||||||
|
request.sender_id,
|
||||||
|
project.guests.keys().copied(),
|
||||||
|
|conn_id| {
|
||||||
|
self.peer.send(
|
||||||
|
conn_id,
|
||||||
|
proto::UnregisterProject {
|
||||||
|
project_id: request.payload.project_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
},
|
||||||
|
);
|
||||||
for (_, receipts) in project.join_requests {
|
for (_, receipts) in project.join_requests {
|
||||||
for receipt in receipts {
|
for receipt in receipts {
|
||||||
self.peer.respond(
|
self.peer.respond(
|
||||||
|
@ -1895,6 +1908,14 @@ mod tests {
|
||||||
.update(cx_b, |p, cx| p.open_buffer((worktree_id, "a.txt"), cx))
|
.update(cx_b, |p, cx| p.open_buffer((worktree_id, "a.txt"), cx))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
// When client A (the host) leaves, the project gets unshared and guests are notified.
|
||||||
|
cx_a.update(|_| drop(project_a));
|
||||||
|
deterministic.run_until_parked();
|
||||||
|
project_b2.read_with(cx_b, |project, _| {
|
||||||
|
assert!(project.is_read_only());
|
||||||
|
assert!(project.collaborators().is_empty());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test(iterations = 10)]
|
#[gpui::test(iterations = 10)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue