Show redirects correctly on diff pages.
authorLiangent <liangent@gmail.com>
Fri, 28 Sep 2012 13:07:04 +0000 (21:07 +0800)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 11 Oct 2012 05:08:19 +0000 (05:08 +0000)
Change-Id: Ic3c2d6cff016a8fecdde511e2d14b30426737c8a

includes/diff/DifferenceEngine.php

index 18dcfe9..d638c48 100644 (file)
@@ -544,8 +544,19 @@ class DifferenceEngine extends ContextSource {
 
                                $parserOutput = $this->getParserOutput( $wikiPage, $this->mNewRev );
 
-                               # WikiPage::getParserOutput() should not return false, but just in case
-                               if( $parserOutput ) {
+                               # Also try to load it as a redirect
+                               $rt = $this->mNewContent->getRedirectTarget();
+
+                               if ( $rt ) {
+                                       $article = Article::newFromTitle( $this->mNewPage, $this->getContext() );
+                                       $out->addHTML( $article->viewRedirect( $rt ) );
+
+                                       # WikiPage::getParserOutput() should not return false, but just in case
+                                       if ( $parserOutput ) {
+                                               # Show categories etc.
+                                               $out->addParserOutputNoText( $parserOutput );
+                                       }
+                               } else if ( $parserOutput ) {
                                        $out->addParserOutput( $parserOutput );
                                }
                        }