Call contact on enter

This commit is contained in:
Antonio Scandurra 2022-10-08 14:43:41 +02:00
parent d14744d02f
commit 59aaf4ce1b

View file

@ -282,6 +282,17 @@ impl ContactsPopover {
let section = *section; let section = *section;
self.toggle_expanded(&ToggleExpanded(section), cx); self.toggle_expanded(&ToggleExpanded(section), cx);
} }
ContactEntry::Contact(contact) => {
if contact.online && !contact.busy {
self.call(
&Call {
recipient_user_id: contact.user.id,
initial_project: Some(self.project.clone()),
},
cx,
);
}
}
_ => {} _ => {}
} }
} }
@ -636,6 +647,7 @@ impl ContactsPopover {
cx: &mut RenderContext<Self>, cx: &mut RenderContext<Self>,
) -> ElementBox { ) -> ElementBox {
let online = contact.online; let online = contact.online;
let busy = contact.busy;
let user_id = contact.user.id; let user_id = contact.user.id;
let initial_project = project.clone(); let initial_project = project.clone();
let mut element = let mut element =
@ -688,7 +700,7 @@ impl ContactsPopover {
.boxed() .boxed()
}) })
.on_click(MouseButton::Left, move |_, cx| { .on_click(MouseButton::Left, move |_, cx| {
if online { if online && !busy {
cx.dispatch_action(Call { cx.dispatch_action(Call {
recipient_user_id: user_id, recipient_user_id: user_id,
initial_project: Some(initial_project.clone()), initial_project: Some(initial_project.clone()),