Clean up projects when leaving a room

This commit is contained in:
Max Brunsfeld 2022-12-20 16:44:39 -08:00
parent 21d6665c37
commit bb00134f5f
2 changed files with 22 additions and 4 deletions

View file

@ -240,6 +240,22 @@ impl Room {
cx.notify();
cx.emit(Event::Left);
log::info!("leaving room");
for project in self.shared_projects.drain() {
if let Some(project) = project.upgrade(cx) {
project.update(cx, |project, cx| {
project.unshare(cx).log_err();
});
}
}
for project in self.joined_projects.drain() {
if let Some(project) = project.upgrade(cx) {
project.update(cx, |project, cx| {
project.disconnected_from_host(cx);
});
}
}
self.status = RoomStatus::Offline;
self.remote_participants.clear();
self.pending_participants.clear();