From 7ff7553aa92cf8e5b64b625f34dd41749f32ea5e Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Tue, 27 Sep 2022 17:04:39 +0000 Subject: [PATCH] Comments: Prevent AYS prompt when replying to a comment and nothing has been entered. When replying to a comment and nothing has yet been entered for the reply content, clicking "Reply" or "Quick Edit" on another comment presents the "Are you sure..." prompt indicating there are unsaved changes in the reply content. However, if nothing is entered, this prompt should not be displayed. This change implements a new check to determine if any text has been entered by the user before deciding to show the "Are you sure..." prompt. Props cu121, mkox, azouamauriac, hasanuzzamanshamim, pls78, faisal03, rafiahmedd. Fixes #54990. git-svn-id: https://develop.svn.wordpress.org/trunk@54334 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/edit-comments.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/_enqueues/admin/edit-comments.js b/src/js/_enqueues/admin/edit-comments.js index 1d56e7c84352..e7a9282d4bb6 100644 --- a/src/js/_enqueues/admin/edit-comments.js +++ b/src/js/_enqueues/admin/edit-comments.js @@ -1225,7 +1225,7 @@ window.commentReply = { discardCommentChanges: function() { var editRow = $( '#replyrow' ); - if ( this.originalContent === $( '#replycontent', editRow ).val() ) { + if ( '' === $( '#replycontent', editRow ).val() || this.originalContent === $( '#replycontent', editRow ).val() ) { return true; }