Disable Git panel button to open commit editor in certain cases (#26000)
Also: - Internally renames a bit of code to make it easy to identify between when we are disabling the buttons that open and close the modal editor (in Git Panel and Project Diff) vs when we are disabling the commit buttons (in Git Panel and Git commit editor modal). - Deletes some unused code. Release Notes: - Unified disabling / enabling the button to open the Git commit editor modal in the Git panel with the Project Diff commit button. - Unified disabling / enabling the commit buttons, for the same cases, between the Git panel and Git commit editor modal.
This commit is contained in:
parent
1f7fa80166
commit
8c4da9fba0
4 changed files with 19 additions and 33 deletions
|
@ -1917,7 +1917,7 @@ impl GitPanel {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn can_commit(&self) -> bool {
|
||||
pub fn can_open_commit_editor(&self) -> bool {
|
||||
(self.has_staged_changes() || self.has_tracked_changes()) && !self.has_unstaged_conflicts()
|
||||
}
|
||||
|
||||
|
@ -2000,6 +2000,7 @@ impl GitPanel {
|
|||
let panel_editor_style = panel_editor_style(true, window, cx);
|
||||
|
||||
if let Some(active_repo) = active_repository {
|
||||
let can_open_commit_editor = self.can_open_commit_editor();
|
||||
let (can_commit, tooltip) = self.configure_commit_button(cx);
|
||||
|
||||
let enable_coauthors = self.render_co_authors(cx);
|
||||
|
@ -2092,6 +2093,7 @@ impl GitPanel {
|
|||
.icon_size(IconSize::Small)
|
||||
.style(ButtonStyle::Transparent)
|
||||
.width(expand_button_size.into())
|
||||
.disabled(!can_open_commit_editor)
|
||||
.on_click(cx.listener({
|
||||
move |_, _, window, cx| {
|
||||
window.dispatch_action(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue