This commit is contained in:
Max Brunsfeld 2021-09-21 13:37:37 -07:00
parent 729896d32a
commit 6d0b84a467

View file

@ -1,5 +1,4 @@
use crate::db::{ChannelId, UserId};
use crate::errors::TideResultExt;
use anyhow::anyhow;
use std::collections::{hash_map, HashMap, HashSet};
use zrpc::{proto, ConnectionId};
@ -190,23 +189,20 @@ impl Store {
}
}
if let Ok(host_user_id) = self
.user_id_for_connection(worktree.host_connection_id)
.context("stale worktree host connection")
{
let host =
collaborators
.entry(host_user_id)
.or_insert_with(|| proto::Collaborator {
user_id: host_user_id.to_proto(),
worktrees: Vec::new(),
});
host.worktrees.push(proto::WorktreeMetadata {
id: *worktree_id,
root_name: worktree.root_name.clone(),
is_shared: worktree.share().is_ok(),
guests: guests.into_iter().collect(),
});
if let Ok(host_user_id) = self.user_id_for_connection(worktree.host_connection_id) {
collaborators
.entry(host_user_id)
.or_insert_with(|| proto::Collaborator {
user_id: host_user_id.to_proto(),
worktrees: Vec::new(),
})
.worktrees
.push(proto::WorktreeMetadata {
id: *worktree_id,
root_name: worktree.root_name.clone(),
is_shared: worktree.share.is_some(),
guests: guests.into_iter().collect(),
});
}
}