Use a different style for inactive participants

This commit is contained in:
Antonio Scandurra 2022-10-04 14:50:41 +02:00
parent 456dde200c
commit de917c4678
5 changed files with 82 additions and 35 deletions

View file

@ -159,14 +159,7 @@ impl ContactsPopover {
let active_call = ActiveCall::global(cx);
let mut subscriptions = Vec::new();
subscriptions.push(cx.observe(&user_store, |this, _, cx| this.update_entries(cx)));
subscriptions.push(cx.observe(&active_call, |this, active_call, cx| {
if let Some(room) = active_call.read(cx).room().cloned() {
this.room_subscription = Some(cx.observe(&room, |_, _, cx| cx.notify()));
} else {
this.room_subscription = None;
}
cx.notify();
}));
subscriptions.push(cx.observe(&active_call, |this, _, cx| this.active_call_changed(cx)));
let mut this = Self {
room_subscription: None,
@ -180,9 +173,19 @@ impl ContactsPopover {
user_store,
};
this.update_entries(cx);
this.active_call_changed(cx);
this
}
fn active_call_changed(&mut self, cx: &mut ViewContext<Self>) {
if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
self.room_subscription = Some(cx.observe(&room, |_, _, cx| cx.notify()));
} else {
self.room_subscription = None;
}
cx.notify();
}
fn clear_filter(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
let did_clear = self.filter_editor.update(cx, |editor, cx| {
if editor.buffer().read(cx).len(cx) > 0 {