Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -424,7 +424,11 @@ |
425 | 425 | $quality = FlaggedRevs::isQuality( $flags ); |
426 | 426 | $pristine = FlaggedRevs::isPristine( $flags ); |
427 | 427 | $text = $frev->getRevText(); |
428 | | - $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $frev->getRevId() ); |
| 428 | + # Check if this is a redirect... |
| 429 | + $redirHtml = $this->getRedirectHtml( $text ); |
| 430 | + if( $redirHtml == '' ) { |
| 431 | + $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $frev->getRevId() ); |
| 432 | + } |
429 | 433 | # Construct some tagging for non-printable outputs. Note that the pending |
430 | 434 | # notice has all this info already, so don't do this if we added that already. |
431 | 435 | if( !$wgOut->isPrintable() ) { |
— | — | @@ -461,7 +465,11 @@ |
462 | 466 | } |
463 | 467 | # Output HTML |
464 | 468 | $this->setReviewNotes( $frev ); |
465 | | - $wgOut->addParserOutput( $parserOut ); |
| 469 | + if( $redirHtml != '' ) { |
| 470 | + $wgOut->addHtml( $redirHtml ); |
| 471 | + } else { |
| 472 | + $wgOut->addParserOutput( $parserOut ); |
| 473 | + } |
466 | 474 | # Index the stable version only |
467 | 475 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
468 | 476 | } |
— | — | @@ -489,11 +497,10 @@ |
490 | 498 | if( $parserOut == false ) { |
491 | 499 | $text = $srev->getRevText(); |
492 | 500 | # Check if this is a redirect... |
493 | | - $rTarget = $this->article->followRedirectText( $text ); |
494 | | - if( $rTarget ) { |
495 | | - $redirHtml = $this->article->viewRedirect( $rTarget ); |
496 | | - } else { |
497 | | - $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $srev->getRevId() ); |
| 501 | + $redirHtml = $this->getRedirectHtml( $text ); |
| 502 | + if( $redirHtml == '' ) { |
| 503 | + $parserOut = FlaggedRevs::parseStableText( |
| 504 | + $this->article, $text, $srev->getRevId() ); |
498 | 505 | # Update the stable version cache |
499 | 506 | FlaggedRevs::updatePageCache( $this->article, $wgUser, $parserOut ); |
500 | 507 | } |
— | — | @@ -547,6 +554,14 @@ |
548 | 555 | $wgOut->addParserOutput( $parserOut ); |
549 | 556 | } |
550 | 557 | } |
| 558 | + |
| 559 | + protected function getRedirectHtml( $text ) { |
| 560 | + $rTarget = $this->article->followRedirectText( $text ); |
| 561 | + if( $rTarget ) { |
| 562 | + return $this->article->viewRedirect( $rTarget ); |
| 563 | + } |
| 564 | + return ''; |
| 565 | + } |
551 | 566 | |
552 | 567 | /** |
553 | 568 | * @param FlaggedRevision $srev, stable version |