Skip to content

Commit

Permalink
Prevent an unnecessary warning message after submitting quick notes
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-ys committed Oct 26, 2024
1 parent ea62d3e commit d719e52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/views/enhanced_ux/issues/_custom_issue.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,12 @@
.attr("id", "quick_notes2-submit-button")
.text(resources.labelSubmitQuickNotesWithAttachments)
.on("click", () => {
asyncAjaxSubmitNotesWithAttachments().then(resetForm);
asyncAjaxSubmitNotesWithAttachments().then(() => {
resetForm();
$("textarea#issue_notes")
.removeData("changed")
.removeAttr("data-changed"); // Suppor for 2-pane mode
});
})
.appendTo($quickNotes2Buttons);

Expand Down
9 changes: 8 additions & 1 deletion app/views/enhanced_ux/layouts/_two_pane_mode.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,14 @@

switchable() {
if (!this.checkTextAreaChange()) return true;
return confirm(warnLeavingUnsavedMessage);
if (confirm(warnLeavingUnsavedMessage)) {
// Clear all flags
$("textarea", this.$iframe.contents()).each(function () {
$(this).removeData("changed").removeAttr("data-changed");
});
return true;
}
return false;
}

checkTextAreaChange() {
Expand Down

0 comments on commit d719e52

Please sign in to comment.