Skip to content

Commit

Permalink
Comments: Prevent AYS prompt when replying to a comment and nothing h…
Browse files Browse the repository at this point in the history
…as 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
  • Loading branch information
dream-encode authored and = committed Nov 4, 2022
1 parent d8dcde1 commit 8f66875
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/_enqueues/admin/edit-comments.js
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8f66875

Please sign in to comment.