From 4f77631dd42c29121678368b3447e9373af23c87 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 23 Jun 2008 22:45:19 +0000 Subject: [PATCH] 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 --- wp-admin/revision.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-admin/revision.php b/wp-admin/revision.php index a00fa8153..4ec274f37 100644 --- a/wp-admin/revision.php +++ b/wp-admin/revision.php @@ -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 ) );