Merge "Don't show empty page state on redirect pages"

This commit is contained in:
jenkins-bot 2022-07-28 22:26:11 +00:00 committed by Gerrit Code Review
commit a18c5c3e3a
2 changed files with 11 additions and 10 deletions

View file

@ -316,11 +316,11 @@ class HookUtils {
// Match the logic in MediaWiki core (as defined in SkinTemplate::buildContentNavigationUrlsInternal):
// https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/add6d0a0e38167a710fb47fac97ff3004451494c/includes/skins/SkinTemplate.php#1317
// * __NONEWSECTIONLINK__ is not present (OutputPage::forceHideNewSectionLink) and...
// - This is the current revision in a talk namespace (Title::isTalkPage) or...
// - This is the current revision of a non-redirect in a talk namespace or...
// - __NEWSECTIONLINK__ is present (OutputPage::showNewSectionLink)
return (
!static::hasPagePropCached( $title, 'nonewsectionlink' ) &&
( ( $title->isTalkPage() && $output->isRevisionCurrent() ) ||
( ( $title->isTalkPage() && !$title->isRedirect() && $output->isRevisionCurrent() ) ||
static::hasPagePropCached( $title, 'newsectionlink' ) )
);
}

View file

@ -204,15 +204,16 @@ class PageHooks implements
$text, $lang
);
}
if ( HookUtils::shouldDisplayEmptyState( $output->getContext() ) ) {
if ( CommentFormatter::isEmptyTalkPage( $text ) ) {
if (
CommentFormatter::isEmptyTalkPage( $text ) &&
HookUtils::shouldDisplayEmptyState( $output->getContext() )
) {
$output->enableOOUI();
$text = CommentFormatter::appendToEmptyTalkPage(
$text, $this->getEmptyStateHtml( $output->getContext() )
);
$output->addBodyClasses( 'ext-discussiontools-emptystate-shown' );
}
}
if ( HookUtils::isFeatureEnabledForOutput( $output, HookUtils::VISUALENHANCEMENTS ) ) {
$output->enableOOUI();
if ( HookUtils::isFeatureEnabledForOutput( $output, HookUtils::TOPICSUBSCRIPTION ) ) {