.
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m42s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 5m42s

This commit is contained in:
2026-01-27 15:40:36 +07:00
parent a39725b1d3
commit 0d5bc286f7
3 changed files with 23 additions and 17 deletions

View File

@@ -121,6 +121,8 @@ impl ChatRegistry {
// Track unwrapping progress
this.tracking(cx);
}
// Get chat rooms from the database on every identity change
this.get_rooms(cx);
}),
);

View File

@@ -158,11 +158,19 @@ impl RenderOnce for RoomListItem {
.child(name),
)
.child(
div()
h_flex()
.gap_1p5()
.flex_shrink_0()
.text_xs()
.text_color(cx.theme().text_placeholder)
.child(created_at),
.child(created_at)
.when_some(self.kind, |this, kind| {
this.when(kind == RoomKind::Request, |this| {
this.child(
div().size_1().rounded_full().bg(cx.theme().icon_accent),
)
})
}),
),
)
.hover(|this| this.bg(cx.theme().elevated_surface_background))

View File

@@ -523,24 +523,20 @@ impl Sidebar {
_window: &Window,
cx: &Context<Self>,
) -> Vec<impl IntoElement> {
let chat = ChatRegistry::global(cx);
// Get all rooms from search results or chat registry
let all_rooms = match self.search_results.read(cx).as_ref() {
// Get rooms from search results first
let rooms = match self.search_results.read(cx).as_ref() {
Some(results) => results,
None => chat.read(cx).rooms(cx),
None => {
// Fallback to chat registry if there are no search results
let chat = ChatRegistry::global(cx);
chat.read(cx).rooms(cx)
}
};
// If no rooms are found, return a placeholder element for each index in the range
let Some(visible_rooms) = all_rooms.get(range.clone()) else {
return range
.into_iter()
.map(|ix| RoomListItem::new(ix).into_any_element())
.collect();
};
visible_rooms
.iter()
rooms
.get(range.clone())
.into_iter()
.flatten()
.enumerate()
.map(|(ix, item)| {
let this = item.read(cx);