better handling of comparing a revision to itself. Props mdawaffe. see #6775

git-svn-id: http://svn.automattic.com/wordpress/trunk@8176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-06-23 22:45:19 +00:00
parent 88f779c343
commit 4f77631dd4
1 changed files with 6 additions and 0 deletions

View File

@ -43,6 +43,12 @@ case 'diff' :
if ( !current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) )
break;
// If we're comparing a revision to itself, redirect to the 'view' page for that revision or the edit page for that post
if ( $left_revision->ID == $right_revision->ID ) {
$redirect = get_edit_post_link( $left_revision->ID );
break;
}
// Don't allow reverse diffs?
if ( strtotime($right_revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt) ) {
$redirect = add_query_arg( array( 'left' => $right, 'right' => $left ) );