Adds UI for showing the followed-by status to collaboration

This commit is contained in:
Mikayla Maki 2023-01-19 14:22:12 -08:00
parent 4a46227909
commit 4eeb1aec50
2 changed files with 20 additions and 3 deletions

View file

@ -1623,6 +1623,7 @@ impl Workspace {
project_id,
leader_id: Some(leader_id),
});
Some(cx.spawn_weak(|this, mut cx| async move {
let response = request.await?;
if let Some(this) = this.upgrade(&cx) {
@ -1719,6 +1720,10 @@ impl Workspace {
self.follower_states_by_leader.contains_key(&peer_id)
}
pub fn is_followed(&self, peer_id: PeerId) -> bool {
self.leader_state.followers.contains(&peer_id)
}
fn render_titlebar(&self, theme: &Theme, cx: &mut RenderContext<Self>) -> ElementBox {
let project = &self.project.read(cx);
let mut worktree_root_names = String::new();
@ -1896,6 +1901,9 @@ impl Workspace {
.to_proto(),
)
});
cx.notify();
Ok(proto::FollowResponse {
active_view_id,
views: this
@ -1928,10 +1936,11 @@ impl Workspace {
_: Arc<Client>,
mut cx: AsyncAppContext,
) -> Result<()> {
this.update(&mut cx, |this, _| {
this.update(&mut cx, |this, cx| {
this.leader_state
.followers
.remove(&envelope.original_sender_id()?);
cx.notify();
Ok(())
})
}