Move project sharing into Room

This commit is contained in:
Antonio Scandurra 2022-10-07 10:14:17 +02:00
parent 3d467a9491
commit b479c8c8ba
5 changed files with 210 additions and 140 deletions

View file

@ -240,6 +240,25 @@ impl Room {
})
}
pub(crate) fn share_project(
&mut self,
project: ModelHandle<Project>,
cx: &mut ModelContext<Self>,
) -> Task<Result<u64>> {
let request = self
.client
.request(proto::ShareProject { room_id: self.id() });
cx.spawn_weak(|_, mut cx| async move {
let response = request.await?;
project
.update(&mut cx, |project, cx| {
project.shared(response.project_id, cx)
})
.await?;
Ok(response.project_id)
})
}
pub fn set_location(
&mut self,
project: Option<&ModelHandle<Project>>,