mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Don't show empty page state on redirect pages
Add the redirect check to shouldShowNewSectionTab. Try to run cheaper checks before more expensive ones. Depends-On: I5755863243d8ad336ad20626f439d70eb3b31f32 Bug: T312599 Change-Id: I6848e529a2537d4058613db0c3b900bc9f4f59f8
This commit is contained in:
parent
e1499c0291
commit
fcdd6b0ed5
|
@ -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' ) )
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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 ) ) {
|
||||
|
|
Loading…
Reference in a new issue