Make WordPress Core

Ticket #32818: 32818.2.diff

File 32818.2.diff, 3.1 KB (added by polevaultweb, 9 years ago)

Patch refreshed

  • src/wp-includes/script-loader.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    487487                        'replyApprove' => __( 'Approve and Reply' ),
    488488                        'reply' => __( 'Reply' ),
    489489                        'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
     490                        'warnDiscardChanges' => __( "Are you sure you want to do this?\nThe reply changes you made will be lost." ),
    490491                        'docTitleComments' => __( 'Comments' ),
    491492                        /* translators: %s: comments count */
    492493                        'docTitleCommentsCount' => __( 'Comments (%s)' ),
  • src/wp-admin/js/post.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    272272
    273273                        if ( typeof commentReply !== 'undefined' ) {
    274274                                /*
     275                                 * Don't submit the edit post if a comment reply has been edited
     276                                 * and the user wants to preserve it.
     277                                 */
     278                                if ( ! commentReply.discardChanges() ) {
     279                                        return false;
     280                                }
     281
     282                                /*
    275283                                 * Close the comment edit/reply form if open to stop the form
    276284                                 * action from interfering with the post's form action.
    277285                                 */
  • src/wp-admin/js/edit-comments.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    559559commentReply = {
    560560        cid : '',
    561561        act : '',
     562        originalContent : '',
    562563
    563564        init : function() {
    564565                var row = $('#replyrow');
     
    642643                $( '.spinner', replyrow ).removeClass( 'is-active' );
    643644
    644645                this.cid = '';
     646                this.originalContent = '';
    645647        },
    646648
    647649        open : function(comment_id, post_id, action) {
     
    651653                        h = c.height(),
    652654                        colspanVal = 0;
    653655
     656                if ( ! this.discardChanges() ) {
     657                        // Ask the user to preserve any edits to already open comments
     658                        return false;
     659                }
     660
    654661                t.close();
    655662                t.cid = comment_id;
    656663
     
    659666                action = action || 'replyto';
    660667                act = 'edit' == action ? 'edit' : 'replyto';
    661668                act = t.act = act + '-comment';
     669                t.originalContent = $('textarea.comment', rowData).val();
    662670                colspanVal = $( '> th:visible, > td:visible', c ).length;
    663671
    664672                // Make sure it's actually a table and there's a `colspan` value to apply.
     
    846854                        $('table.comments-box').css('display', '');
    847855                        $('#no-comments').remove();
    848856                });
     857        },
     858
     859        /**
     860         * If an open reply has been changed, warn the user they will lose changes
     861         * and act on the response.
     862         *
     863         * @returns {boolean}
     864         */
     865        discardChanges: function() {
     866                var editRow = $( '#replyrow' );
     867
     868                if  ( this.originalContent === $( '#replycontent', editRow ).val() ) {
     869                        return true;
     870                }
     871
     872                return window.confirm( adminCommentsL10n.warnDiscardChanges );
    849873        }
    850874};
    851875