Revisions: Fix PHP loading of comparison to first revision, and premature rendering of tooltip.

Props aaroncampbell, markjaquith. Fixes #24873 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@24864 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2013-07-29 17:26:03 +00:00
parent 241ca959be
commit 7c99f40451
2 changed files with 11 additions and 7 deletions

View File

@@ -179,8 +179,11 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
// Now, grab the initial diff
$compare_two_mode = is_numeric( $from );
if ( ! $compare_two_mode ) {
$from = array_keys( array_slice( $revisions, array_search( $selected_revision_id, array_keys( $revisions ) ) - 1, 1, true ) );
$from = $from[0];
$found = array_search( $selected_revision_id, array_keys( $revisions ) );
if ( $found )
$from = array_shift( array_keys( array_slice( $revisions, $found - 1, 1, true ) ) );
else
$from = 0;
}
$from = absint( $from );