diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-07-12 01:35:07 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-07-21 22:35:26 +0300 |
commit | 4e86445b9da91762f278619bfe490f9c76f4531b (patch) | |
tree | f27a7f6e77b58ead8f885054ce45306f357c23c1 /app/assets/javascripts | |
parent | ddb193d09d280495ba60dab2ee0c097a57ce4752 (diff) | |
download | gitlab-ce-4e86445b9da91762f278619bfe490f9c76f4531b.tar.gz |
IssueNotesRefactor: Fix issue reopen/close bug after merging from master.
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/issue.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/notes/components/issue_comment_form.vue | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index 2bee4fb045a..733ae48e882 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -42,7 +42,7 @@ class Issue { initIssueBtnEventListeners() { const issueFailMessage = 'Unable to update this issue at this time.'; - return $(document).on('click', 'a.btn-close, a.btn-reopen', (e) => { + return $(document).on('click', '.issuable-actions a.btn-close, .issuable-actions a.btn-reopen', (e) => { var $button, shouldSubmit, url; e.preventDefault(); e.stopImmediatePropagation(); @@ -121,7 +121,7 @@ class Issue { static submitNoteForm(form) { var noteText; noteText = form.find("textarea.js-note-text").val(); - if (noteText.trim().length > 0) { + if (noteText && noteText.trim().length > 0) { return form.submit(); } } diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index e070ee0ff3a..9eb54bc21ed 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -89,7 +89,8 @@ export default { // This is out of scope for the Notes Vue component. // It was the shortest path to update the issue state and relevant places. - $('.js-btn-issue-action:visible').trigger('click'); + const btnClass = this.isIssueOpen ? 'btn-reopen' : 'btn-close'; + $(`.js-btn-issue-action.${btnClass}:visible`).trigger('click'); } }, discard() { @@ -215,7 +216,7 @@ export default { </div> <a @click="handleSave(true)" - :class="{'btn-reopen': issueState === 'closed', 'btn-close': issueState === 'open'}" + :class="{'btn-reopen': !isIssueOpen, 'btn-close': isIssueOpen}" class="btn btn-nr btn-comment"> {{issueActionButtonTitle}} </a> |