WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/29/2013 08:50:09 PM (9 years ago)
Author:
markjaquith
Message:

Make sure the first revision is seen as coming from emptiness, so it can be restored.

props adamsilverstein. fixes #23898.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ajax-actions.php

    r23832 r23872  
    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 ) {
     
    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' ] ) )
     
    21862190
    21872191    $previous_revision_id = 0;
     2192
    21882193    foreach ( $revisions as $revision ) :
    21892194        //error_log( ( $show_autosaves  ));
     
    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,
Note: See TracChangeset for help on using the changeset viewer.