mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
Use PageProps for fetching newsectionlink flag
Now we don't require the ParserOutput to be available. As a result, we now check the flag on the latest revision of the page, rather than the one being viewed. Change-Id: Id77a332643cb8ad95afc5cec6713fa0a3636a5ce
This commit is contained in:
parent
bc04783341
commit
3bb2d25a74
|
@ -15,6 +15,7 @@ use ExtensionRegistry;
|
|||
use MediaWiki\MediaWikiServices;
|
||||
use MWExceptionHandler;
|
||||
use OutputPage;
|
||||
use PageProps;
|
||||
use RecentChange;
|
||||
use RequestContext;
|
||||
use Skin;
|
||||
|
@ -106,13 +107,16 @@ class Hooks {
|
|||
)
|
||||
);
|
||||
|
||||
$props = PageProps::getInstance()->getProperties( $title, 'newsectionlink' );
|
||||
$hasNewSectionLink = isset( $props[ $title->getArticleId() ] );
|
||||
|
||||
// Finally check the user has the tool enabled and that the page
|
||||
// supports discussions.
|
||||
return $userEnabled && (
|
||||
// `wantSignatures` includes talk pages
|
||||
$services->getNamespaceInfo()->wantSignatures( $title->getNamespace() ) ||
|
||||
// Treat pages with __NEWSECTIONLINK__ as talk pages (T245890)
|
||||
$output->showNewSectionLink()
|
||||
$hasNewSectionLink
|
||||
// TODO: Consider not loading if forceHideNewSectionLink is true.
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue