* here, there doesn't seem to be any other way to stop calling
* OutputPage::enableSectionEditLinks() and still have it work as it did before.
*/
- private $disableSectionEditForRender = false;
+ protected $viewIsRenderAction = false;
/**
* Constructor and clear the article
if ( $outputPage->isPrintable() ) {
$parserOptions->setIsPrintable( true );
$poOptions['enableSectionEditLinks'] = false;
- } elseif ( $this->disableSectionEditForRender
+ } elseif ( $this->viewIsRenderAction
|| !$this->isCurrent() || !$this->getTitle()->quickUserCan( 'edit', $user )
) {
$poOptions['enableSectionEditLinks'] = false;
$outputPage->setRobotPolicy( 'noindex,nofollow' );
$errortext = $error->getWikiText( false, 'view-pool-error' );
- $outputPage->addWikiText( Html::errorBox( $errortext ) );
+ $outputPage->wrapWikiTextAsInterface( 'errorbox', $errortext );
}
# Connection or timeout error
return;
// Note that the ArticleViewHeader hook is allowed to set $outputDone to a
// ParserOutput instance.
$pOutput = ( $outputDone instanceof ParserOutput )
- // phpcs:ignore MediaWiki.Usage.NestedInlineTernary.UnparenthesizedTernary -- FIXME T203805
? $outputDone // object fetched by hook
- : $this->mParserOutput ?: null; // ParserOutput or null, avoid false
+ : ( $this->mParserOutput ?: null ); // ParserOutput or null, avoid false
# Adjust title for main page & pages with displaytitle
if ( $pOutput ) {
if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
$outputPage->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
[ 'userpage-userdoesnotexist-view', wfEscapeWikiText( $rootPart ) ] );
- } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
- # Show log extract if the user is currently blocked
+ } elseif (
+ !is_null( $block ) &&
+ $block->getType() != Block::TYPE_AUTO &&
+ ( $block->isSitewide() || $user->isBlockedFrom( $title ) )
+ ) {
+ // Show log extract if the user is sitewide blocked or is partially
+ // blocked and not allowed to edit their user page or user talk page
LogEventsList::showLogExtract(
$outputPage,
'block',
$dir = $this->getContext()->getLanguage()->getDir();
$lang = $this->getContext()->getLanguage()->getHtmlCode();
- $outputPage->addWikiText( Xml::openElement( 'div', [
+ $outputPage->addWikiTextAsInterface( Xml::openElement( 'div', [
'class' => "noarticletext mw-content-$dir",
'dir' => $dir,
'lang' => $lang,
public function render() {
$this->getContext()->getRequest()->response()->header( 'X-Robots-Tag: noindex' );
$this->getContext()->getOutput()->setArticleBodyOnly( true );
- $this->disableSectionEditForRender = true;
+ // We later set 'enableSectionEditLinks=false' based on this; also used by ImagePage
+ $this->viewIsRenderAction = true;
$this->view();
}
);
if ( $error == '' ) {
- $outputPage->addWikiText(
- "<div class=\"error mw-error-cannotdelete\">\n" . $status->getWikiText() . "\n</div>"
+ $outputPage->wrapWikiTextAsInterface(
+ 'error mw-error-cannotdelete',
+ $status->getWikiText()
);
$deleteLogPage = new LogPage( 'delete' );
$outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );