From 75679291a9a7353d7ddc444e460163c881806430 Mon Sep 17 00:00:00 2001 From: Mikayla Date: Thu, 17 Aug 2023 00:55:11 -0700 Subject: [PATCH] Add fix for lost channel update bug --- crates/client/src/channel_store.rs | 2 ++ crates/collab/src/db.rs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/client/src/channel_store.rs b/crates/client/src/channel_store.rs index e2c18a63a9..03d334a9de 100644 --- a/crates/client/src/channel_store.rs +++ b/crates/client/src/channel_store.rs @@ -441,10 +441,12 @@ impl ChannelStore { for channel in payload.channels { if let Some(existing_channel) = self.channels_by_id.get_mut(&channel.id) { + // FIXME: We may be missing a path for this existing channel in certain cases let existing_channel = Arc::make_mut(existing_channel); existing_channel.name = channel.name; continue; } + self.channels_by_id.insert( channel.id, Arc::new(Channel { diff --git a/crates/collab/src/db.rs b/crates/collab/src/db.rs index 64349123af..b457c4c116 100644 --- a/crates/collab/src/db.rs +++ b/crates/collab/src/db.rs @@ -3650,7 +3650,11 @@ impl Database { let ancestor_ids = self.get_channel_ancestors(id, tx).await?; let user_ids = channel_member::Entity::find() .distinct() - .filter(channel_member::Column::ChannelId.is_in(ancestor_ids.iter().copied())) + .filter( + channel_member::Column::ChannelId + .is_in(ancestor_ids.iter().copied()) + .and(channel_member::Column::Accepted.eq(true)), + ) .select_only() .column(channel_member::Column::UserId) .into_values::<_, QueryUserIds>()