Commit adc73379 authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: First comment and then close the issue.

parent e0d583cb
...@@ -139,21 +139,26 @@ ...@@ -139,21 +139,26 @@
} else { } else {
this.discard(); this.discard();
} }
if (withIssueAction) {
this.toggleIssueState();
}
}) })
.catch(() => { .catch(() => {
this.isSubmitting = false; this.isSubmitting = false;
this.discard(false); this.discard(false);
}); });
} else {
this.toggleIssueState();
} }
},
toggleIssueState() {
this.issueState = this.isIssueOpen ? constants.CLOSED : constants.REOPENED;
if (withIssueAction) { // This is out of scope for the Notes Vue component.
this.issueState = this.isIssueOpen ? constants.CLOSED : constants.REOPENED; // It was the shortest path to update the issue state and relevant places.
const btnClass = this.isIssueOpen ? 'btn-reopen' : 'btn-close';
// This is out of scope for the Notes Vue component. $(`.js-btn-issue-action.${btnClass}:visible`).trigger('click');
// It was the shortest path to update the issue state and relevant places.
const btnClass = this.isIssueOpen ? 'btn-reopen' : 'btn-close';
$(`.js-btn-issue-action.${btnClass}:visible`).trigger('click');
}
}, },
discard(shouldClear = true) { discard(shouldClear = true) {
// `blur` is needed to clear slash commands autocomplete cache if event fired. // `blur` is needed to clear slash commands autocomplete cache if event fired.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment