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:
parent
291f353085
commit
2a11c22760
4 changed files with 22 additions and 30 deletions
|
@ -58,7 +58,6 @@ pub struct ProjectPanel {
|
|||
workspace: WeakView<Workspace>,
|
||||
width: Option<Pixels>,
|
||||
pending_serialization: Task<Option<()>>,
|
||||
was_deserialized: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
@ -244,7 +243,6 @@ impl ProjectPanel {
|
|||
workspace: workspace.weak_handle(),
|
||||
width: None,
|
||||
pending_serialization: Task::ready(None),
|
||||
was_deserialized: false,
|
||||
};
|
||||
this.update_visible_entries(None, cx);
|
||||
|
||||
|
@ -324,7 +322,6 @@ impl ProjectPanel {
|
|||
if let Some(serialized_panel) = serialized_panel {
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel.width = serialized_panel.width;
|
||||
panel.was_deserialized = true;
|
||||
cx.notify();
|
||||
});
|
||||
}
|
||||
|
@ -1460,9 +1457,6 @@ impl ProjectPanel {
|
|||
cx.notify();
|
||||
}
|
||||
}
|
||||
pub fn was_deserialized(&self) -> bool {
|
||||
self.was_deserialized
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for ProjectPanel {
|
||||
|
@ -1637,6 +1631,14 @@ impl Panel for ProjectPanel {
|
|||
fn persistent_name() -> &'static str {
|
||||
"Project Panel"
|
||||
}
|
||||
|
||||
fn starts_open(&self, cx: &WindowContext) -> bool {
|
||||
self.project.read(cx).visible_worktrees(cx).any(|tree| {
|
||||
tree.read(cx)
|
||||
.root_entry()
|
||||
.map_or(false, |entry| entry.is_dir())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl FocusableView for ProjectPanel {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue