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 {
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();
}
}
......
......@@ -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>
......
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