Fix channel collapsing

This commit is contained in:
Conrad Irwin 2023-10-25 09:27:17 +02:00
parent 6f173c64b3
commit 70eeefa1f8
2 changed files with 15 additions and 11 deletions

View File

@ -188,13 +188,6 @@ impl ChannelStore {
self.client.clone() self.client.clone()
} }
pub fn channel_has_children(&self) -> bool {
self.channel_index
.by_id()
.iter()
.any(|(_, channel)| channel.parent_path.contains(&channel.id))
}
/// Returns the number of unique channels in the store /// Returns the number of unique channels in the store
pub fn channel_count(&self) -> usize { pub fn channel_count(&self) -> usize {
self.channel_index.by_id().len() self.channel_index.by_id().len()

View File

@ -472,9 +472,20 @@ impl CollabPanel {
cx, cx,
) )
} }
ListEntry::Channel { channel, depth, .. } => { ListEntry::Channel {
let channel_row = channel,
this.render_channel(&*channel, *depth, &theme, is_selected, ix, cx); depth,
has_children,
} => {
let channel_row = this.render_channel(
&*channel,
*depth,
&theme,
is_selected,
*has_children,
ix,
cx,
);
if is_selected && this.context_menu_on_selected { if is_selected && this.context_menu_on_selected {
Stack::new() Stack::new()
@ -1867,12 +1878,12 @@ impl CollabPanel {
depth: usize, depth: usize,
theme: &theme::Theme, theme: &theme::Theme,
is_selected: bool, is_selected: bool,
has_children: bool,
ix: usize, ix: usize,
cx: &mut ViewContext<Self>, cx: &mut ViewContext<Self>,
) -> AnyElement<Self> { ) -> AnyElement<Self> {
let channel_id = channel.id; let channel_id = channel.id;
let collab_theme = &theme.collab_panel; let collab_theme = &theme.collab_panel;
let has_children = self.channel_store.read(cx).channel_has_children();
let is_public = self let is_public = self
.channel_store .channel_store
.read(cx) .read(cx)