Make WordPress Core

Ticket #24873: 28873.4.diff

File 28873.4.diff, 1.3 KB (added by adamsilverstein, 13 years ago)

proper diff loading on initial revision reload

  • wp-admin/includes/revision.php

     
    175175                }
    176176                $revisions[ $current_id ]['current'] = true;
    177177        }
    178 
    179178        // Now, grab the initial diff
    180179        $compare_two_mode = is_numeric( $from );
    181180        if ( ! $compare_two_mode ) {
    182                 $from = array_keys( array_slice( $revisions, array_search( $selected_revision_id, array_keys( $revisions ) ) - 1, 1, true ) );
    183                 $from = $from[0];
     181                // Check position of selected revision, if at 0 $from should be 0
     182                $selected_revision_position = array_search( $selected_revision_id, array_keys( $revisions ) );         
     183                if ( 0 !== $selected_revision_position )
     184                        $from = array_keys( array_slice( $revisions, $selected_revision_position - 1, 1, true ) )[0];
     185                else
     186                        $from = 0;
    184187        }
    185188
    186189        $from = absint( $from );
  • wp-admin/js/revisions.js

     
    656656                        _(tickCount).times( function( index ){
    657657                                this.$el.append( '<div style="' + this.direction + ': ' + ( 100 * tickWidth * index ) + '%"></div>' );
    658658                        }, this );
     659
     660                        this.reportTickPosition();
    659661                }
    660662        });
    661663