From fe346c14643fe670dcdac9d17602be0363506945 Mon Sep 17 00:00:00 2001 From: davidbaumwald Date: Tue, 27 Sep 2022 17:06:09 +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. Built from https://develop.svn.wordpress.org/trunk@54334 git-svn-id: http://core.svn.wordpress.org/trunk@53893 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/edit-comments.js | 2 +- wp-admin/js/edit-comments.min.js | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index 1d56e7c843..e7a9282d4b 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/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; } diff --git a/wp-admin/js/edit-comments.min.js b/wp-admin/js/edit-comments.min.js index 4094158f66..609d2ca89d 100644 --- a/wp-admin/js/edit-comments.min.js +++ b/wp-admin/js/edit-comments.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -!function(w){var o,s,i=document.title,C=w("#dashboard_right_now").length,c=wp.i18n.__,x=function(t){t=parseInt(t.html().replace(/[^0-9]+/g,""),10);return isNaN(t)?0:t},r=function(t,e){var n="";if(!isNaN(e)){if(3<(e=e<1?"0":e.toString()).length){for(;3"),e=i,1<=(a=(a=s.exec(document.title))?(a=a[0],o.html(a),x(o)+t):(o.html(0),t))?(r(o,a),(n=s.exec(document.title))&&(e=document.title.replace(n[0],c("Comments (%s)").replace("%s",o.text())+" "))):(n=s.exec(e))&&(e=e.replace(n[0],c("Comments"))),document.title=e},I=function(n,t){var e=".post-com-count-"+t,a="comment-count-no-pending",o="post-com-count-no-pending",s="comment-count-pending";C||l(n),w("span.pending-count").each(function(){var t=w(this),e=x(t)+n;e<1&&(e=0),t.closest(".awaiting-mod")[0===e?"addClass":"removeClass"]("count-0"),r(t,e)}),t&&(t=w("span."+s,e),e=w("span."+a,e),t.each(function(){var t=w(this),e=x(t)+n;0===(e=e<1?0:e)?(t.parent().addClass(o),t.removeClass(s).addClass(a)):(t.parent().removeClass(o),t.addClass(s).removeClass(a)),r(t,e)}),e.each(function(){var t=w(this);0