Commit 4e86445b authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Fix issue reopen/close bug after merging from master.

parent ddb193d0
...@@ -42,7 +42,7 @@ class Issue { ...@@ -42,7 +42,7 @@ class Issue {
initIssueBtnEventListeners() { initIssueBtnEventListeners() {
const issueFailMessage = 'Unable to update this issue at this time.'; 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; var $button, shouldSubmit, url;
e.preventDefault(); e.preventDefault();
e.stopImmediatePropagation(); e.stopImmediatePropagation();
...@@ -121,7 +121,7 @@ class Issue { ...@@ -121,7 +121,7 @@ class Issue {
static submitNoteForm(form) { static submitNoteForm(form) {
var noteText; var noteText;
noteText = form.find("textarea.js-note-text").val(); noteText = form.find("textarea.js-note-text").val();
if (noteText.trim().length > 0) { if (noteText && noteText.trim().length > 0) {
return form.submit(); return form.submit();
} }
} }
......
...@@ -89,7 +89,8 @@ export default { ...@@ -89,7 +89,8 @@ export default {
// This is out of scope for the Notes Vue component. // This is out of scope for the Notes Vue component.
// It was the shortest path to update the issue state and relevant places. // 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() { discard() {
...@@ -215,7 +216,7 @@ export default { ...@@ -215,7 +216,7 @@ export default {
</div> </div>
<a <a
@click="handleSave(true)" @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"> class="btn btn-nr btn-comment">
{{issueActionButtonTitle}} {{issueActionButtonTitle}}
</a> </a>
......
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