Start work on read-only project access for channel guests

Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-01-02 11:44:51 -08:00 committed by Conrad Irwin
parent 1bc2e0ee5c
commit 28c39aae17
12 changed files with 160 additions and 57 deletions

View file

@ -1659,7 +1659,7 @@ impl Project {
cx.emit(Event::Closed);
}
pub fn is_read_only(&self) -> bool {
pub fn is_disconnected(&self) -> bool {
match &self.client_state {
Some(ProjectClientState::Remote {
sharing_has_stopped,
@ -1669,6 +1669,10 @@ impl Project {
}
}
pub fn is_read_only(&self) -> bool {
self.is_disconnected()
}
pub fn is_local(&self) -> bool {
match &self.client_state {
Some(ProjectClientState::Remote { .. }) => false,
@ -6015,7 +6019,7 @@ impl Project {
this.upgrade().context("project dropped")?;
let response = rpc.request(message).await?;
let this = this.upgrade().context("project dropped")?;
if this.update(&mut cx, |this, _| this.is_read_only())? {
if this.update(&mut cx, |this, _| this.is_disconnected())? {
Err(anyhow!("disconnected before completing request"))
} else {
request
@ -7942,7 +7946,7 @@ impl Project {
if let Some(buffer) = buffer {
break buffer;
} else if this.update(&mut cx, |this, _| this.is_read_only())? {
} else if this.update(&mut cx, |this, _| this.is_disconnected())? {
return Err(anyhow!("disconnected before buffer {} could be opened", id));
}