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.
Built from https://develop.svn.wordpress.org/trunk@54334


git-svn-id: https://core.svn.wordpress.org/trunk@53893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
dream-encode committed Sep 27, 2022
1 parent 6ce3c91 commit 6a07a8e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wp-admin/js/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 6a07a8e

Please sign in to comment.