Undo making project optional on stored follower states

Following works without a project, but following in unshared projects does
not need to be replicated to other participants.
This commit is contained in:
Max Brunsfeld 2023-09-28 14:21:44 -07:00
parent ce940da8e9
commit e9c1ad6acd
9 changed files with 47 additions and 93 deletions

View file

@ -58,7 +58,7 @@ pub struct ActiveCall {
_subscriptions: Vec<client::Subscription>,
}
#[derive(PartialEq, Eq, PartialOrd, Ord)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
struct Follower {
project_id: Option<u64>,
peer_id: PeerId,

View file

@ -62,7 +62,7 @@ pub struct Room {
leave_when_empty: bool,
client: Arc<Client>,
user_store: ModelHandle<UserStore>,
follows_by_leader_id_project_id: HashMap<(PeerId, Option<u64>), Vec<PeerId>>,
follows_by_leader_id_project_id: HashMap<(PeerId, u64), Vec<PeerId>>,
subscriptions: Vec<client::Subscription>,
pending_room_update: Option<Task<()>>,
maintain_connection: Option<Task<Option<()>>>,
@ -584,7 +584,7 @@ impl Room {
pub fn followers_for(&self, leader_id: PeerId, project_id: u64) -> &[PeerId] {
self.follows_by_leader_id_project_id
.get(&(leader_id, Some(project_id)))
.get(&(leader_id, project_id))
.map_or(&[], |v| v.as_slice())
}