Handle unshared projects when rejoining a room

Also, construct remote projects via the room, to guarantee
that the room can manage the projects' sharing lifecycle.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-12-20 11:10:46 -08:00
parent 9d15b3d295
commit 55ebfe8321
7 changed files with 120 additions and 48 deletions

View file

@ -1440,9 +1440,20 @@ impl Database {
});
}
// TODO: handle unshared projects
// TODO: handle left projects
project::Entity::delete_many()
.filter(
Condition::all()
.add(project::Column::RoomId.eq(room_id))
.add(project::Column::HostUserId.eq(user_id))
.add(
project::Column::Id
.is_not_in(reshared_projects.iter().map(|project| project.id)),
),
)
.exec(&*tx)
.await?;
// TODO: handle left projects
let room = self.get_room(room_id, &tx).await?;
Ok((
room_id,
@ -2971,6 +2982,7 @@ impl ProjectCollaborator {
}
}
#[derive(Debug)]
pub struct LeftProject {
pub id: ProjectId,
pub host_user_id: UserId,