[wp-trac] [WordPress Trac] #54990: Unload handler for inline replies to comments displays "Are you sure.." alert when nothing has been entered

WordPress Trac noreply at wordpress.org
Tue Feb 1 09:43:00 UTC 2022


#54990: Unload handler for inline replies to comments displays "Are you sure.."
alert when nothing has been entered
-------------------------------------------------+-------------------------
 Reporter:  davidbaumwald                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  Comments                             |     Version:  4.6
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch reporter-   |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by hasanuzzamanshamim):

 I tested this issue with the provided patch; this will logically work for
 this case only:
 1. click on "reply"
 2. click on "quick edit".
 it works perfectly cause this time the reply content is empty.
 But if somehow I trigger the "reply" again without changing any value this
 will throw the alert. cause the value we checked is not empty now.
 {{{
 $( '#replycontent', editRow ).val() // not empty when quick edit
 }}}
  I think this hardcoded empty string check will not solve this issue for
 edit reply.
 {{{#!php

         discardCommentChanges: function() {
                 var editRow = $( '#replyrow' );

                 if  ( '' === $( '#replycontent', editRow ).val() ) {
                         return true;
                 }

                 return window.confirm( __( 'Are you sure you want to do
 this?\nThe comment changes you made will be lost.' ) );
         }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54990#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list