Make WordPress Core

Ticket #23898: 23898.diff

File 23898.diff, 3.5 KB (added by adamsilverstein, 12 years ago)

fixes

  • wp-includes/post-template.php

     
    14261426        // The following removes that revision when $parent == false
    14271427        $parent_included = _wp_last_revision_matches_current_post( $post_id );
    14281428        if ( $parent_included && ! $parent )
    1429                 array_pop( $revisions );
     1429                array_shift( $revisions );
    14301430        elseif ( ! $parent_included && $parent )
    14311431                array_unshift( $revisions, $post );
    14321432
     
    14361436        foreach ( $revisions as $revision ) {
    14371437                if ( !current_user_can( 'read_post', $revision->ID ) )
    14381438                        continue;
    1439                
     1439
    14401440                $is_autosave = wp_is_post_autosave( $revision );
    14411441                if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) )
    14421442                        continue;
  • wp-admin/includes/ajax-actions.php

     
    21302130        if ( 0 != $single_revision_id ) {
    21312131                $right_revision = get_post( $single_revision_id );
    21322132
     2133        if ( 0 == $compare_to )
     2134                        $left_revision = get_post( $post_id );
     2135
    21332136        // make sure the right revision is the most recent
    21342137        if ( $compare_two_mode && $right_revision->ID < $left_revision->ID ) {
    21352138                $temp = $left_revision;
     
    21552158                        if ( ! empty( $show_split_view ) )
    21562159                                 $args = array( 'show_split_view' => true );
    21572160
    2158                         $diff = wp_text_diff_with_count( $left_content, $right_content, $args );
     2161                        // compare_to == 0 means first revision, so compare to a blank field to show whats changed
     2162                        $diff = wp_text_diff_with_count( ( 0 == $compare_to) ? '' : $left_content, $right_content, $args );
    21592163
    21602164                        if ( isset( $diff[ 'html' ] ) )
    21612165                                $content .= $diff[ 'html' ];
     
    21852189        $revisions = array_reverse( $revisions );
    21862190
    21872191        $previous_revision_id = 0;
     2192
    21882193        foreach ( $revisions as $revision ) :
    21892194                //error_log( ( $show_autosaves  ));
    21902195                if ( empty( $show_autosaves ) && wp_is_post_autosave( $revision ) )
     
    22692274                        $revision_from_date_author = $revision_date_author;
    22702275                        $revision_date_author = $tmp;
    22712276                }
    2272                 if ( ( $compare_two_mode || 0 !== $previous_revision_id ) ) {
     2277                if ( ( $compare_two_mode || -1 !== $previous_revision_id ) ) {
    22732278                        $alltherevisions[] = array (
    22742279                                'ID' => $revision->ID,
    22752280                                'revision_date_author' => $revision_date_author,
  • wp-admin/js/revisions.js

     
    424424                        // render the revisions
    425425                        render: function() {
    426426                                var addHtml = '';
     427                                var thediff;
    427428                                // compare two revisions mode?
    428429
    429430                                if ( 2 === REVAPP._compareOneOrTwo ) {
     431
    430432                                        this.comparetwochecked = 'checked';
    431433                                        if ( this.draggingLeft ) {
    432                                                         if ( this.model.at( REVAPP._leftDiff ) ) {
     434                                                thediff = REVAPP._leftDiff -1;
     435                                                if ( this.model.at( thediff ) ) {
    433436                                                        addHtml = this.template( _.extend(
    434                                                                 this.model.at( REVAPP._leftDiff ).toJSON(),
     437                                                                this.model.at( thediff ).toJSON(),
    435438                                                                { comparetwochecked: this.comparetwochecked } // keep the checkmark checked
    436439                                                        ) );
    437440                                                }
    438441                                        } else { // dragging right handle
    439                                                 var thediff = REVAPP._rightDiff;
     442                                                thediff = REVAPP._rightDiff -1;
    440443                                                if ( this.model.at( thediff ) ) {
    441444                                                        addHtml = this.template( _.extend(
    442445                                                                this.model.at( thediff ).toJSON(),