Skip to content

Commit 6407737

Browse files
remove empty if block
1 parent 5b107dc commit 6407737

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/components/GitPanel.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
817817
const dialog = new Dialog({
818818
title: this.props.trans.__('Notebook outputs detected'),
819819
body: `You are about to commit ${notebooksWithOutputs.length} notebook(s) with outputs.
820-
Would you like to clean them before committing?`,
820+
Would you like to clean them before committing? If you prefer not to be asked every time, you can enable the "Clear outputs before commit" option in the settings.`,
821821
buttons: [
822822
Dialog.cancelButton({
823823
label: this.props.trans.__('Commit Anyway')
@@ -831,19 +831,21 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
831831
const result = await dialog.launch();
832832
dialog.dispose();
833833

834-
if (result.button.label === this.props.trans.__('Commit Anyway')) {
835-
} else if (
836-
result.button.label === this.props.trans.__('Clean & Commit')
837-
) {
834+
if (result.button.label === this.props.trans.__('Cancel')) {
835+
return;
836+
}
837+
const accepted =
838+
typeof result.button.accept === 'boolean'
839+
? result.button.accept
840+
: result.button.label === this.props.trans.__('Clean & Commit');
841+
if (accepted) {
838842
id = Notification.emit(
839843
this.props.trans.__('Cleaning notebook outputs…'),
840844
'in-progress',
841845
{ autoClose: false }
842846
);
843847

844848
await this.props.model.stripNotebooksOutputs(notebooksWithOutputs);
845-
} else {
846-
return;
847849
}
848850
} else if (this.props.settings.composite['clearOutputsBeforeCommit']) {
849851
id = Notification.emit(

0 commit comments

Comments
 (0)