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

@ -179,27 +179,12 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
)?;
workspace_handle.update(&mut cx, |workspace, cx| {
let was_deserialized = project_panel.read(cx).was_deserialized();
workspace.add_panel(project_panel, cx);
workspace.add_panel(terminal_panel, cx);
workspace.add_panel(assistant_panel, cx);
workspace.add_panel(channels_panel, cx);
workspace.add_panel(chat_panel, cx);
workspace.add_panel(notification_panel, cx);
if !was_deserialized
&& workspace
.project()
.read(cx)
.visible_worktrees(cx)
.any(|tree| {
tree.read(cx)
.root_entry()
.map_or(false, |entry| entry.is_dir())
})
{
workspace.open_panel::<ProjectPanel>(cx);
}
cx.focus_self();
})
})