Ensure chat opens when guests join shared projects

This was broken because the panel was created before being added to a
dock. Invert the control order and add `starts_open()` to the Panel
trait.
This commit is contained in:
Conrad Irwin 2024-01-24 12:06:03 -07:00
parent 291f353085
commit 2a11c22760
4 changed files with 22 additions and 30 deletions

View file

@ -132,14 +132,6 @@ impl ChatPanel {
{
this.select_channel(channel_id, None, cx)
.detach_and_log_err(cx);
if ActiveCall::global(cx)
.read(cx)
.room()
.is_some_and(|room| room.read(cx).contains_guests())
{
cx.emit(PanelEvent::Activate)
}
}
this.subscriptions.push(cx.subscribe(
@ -665,6 +657,13 @@ impl Panel for ChatPanel {
fn toggle_action(&self) -> Box<dyn gpui::Action> {
Box::new(ToggleFocus)
}
fn starts_open(&self, cx: &WindowContext) -> bool {
ActiveCall::global(cx)
.read(cx)
.room()
.is_some_and(|room| room.read(cx).contains_guests())
}
}
impl EventEmitter<PanelEvent> for ChatPanel {}