diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-08-21 21:20:44 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-08-21 21:45:28 +0300 |
commit | adc73379f3bc41c2ffa50e0437a101458ff65f58 (patch) | |
tree | e17ea3e03c05909ac9519fb8e70ca84e968a6363 /app/assets/javascripts/notes | |
parent | e0d583cb7311361597b118a72639247bdb122141 (diff) |
IssueNotesRefactor: First comment and then close the issue.
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r-- | app/assets/javascripts/notes/components/issue_comment_form.vue | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index 0a9c6c2916a..421ed7ab686 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -139,21 +139,26 @@ } else { this.discard(); } + + if (withIssueAction) { + this.toggleIssueState(); + } }) .catch(() => { this.isSubmitting = false; this.discard(false); }); + } else { + this.toggleIssueState(); } + }, + toggleIssueState() { + this.issueState = this.isIssueOpen ? constants.CLOSED : constants.REOPENED; - if (withIssueAction) { - this.issueState = this.isIssueOpen ? constants.CLOSED : constants.REOPENED; - - // This is out of scope for the Notes Vue component. - // 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'); - } + // This is out of scope for the Notes Vue component. + // 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) { // `blur` is needed to clear slash commands autocomplete cache if event fired. |