mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Avoid using Title in addNavigationLinks
Simple TitleValue object will do the same job. I verified LinkRenderer localizes the targets. Change-Id: Ia25659947da1d2d7e5557884b2ab9153c9c1bc43
This commit is contained in:
parent
fa0fb1e84b
commit
ca806b46b7
|
@ -5,7 +5,7 @@ namespace MediaWiki\Extension\AbuseFilter\Special;
|
|||
use HtmlArmor;
|
||||
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
|
||||
use SpecialPage;
|
||||
use Title;
|
||||
use TitleValue;
|
||||
use Xml;
|
||||
|
||||
/**
|
||||
|
@ -39,22 +39,22 @@ abstract class AbuseFilterSpecialPage extends SpecialPage {
|
|||
$user = $this->getUser();
|
||||
|
||||
$linkDefs = [
|
||||
'home' => 'Special:AbuseFilter',
|
||||
'recentchanges' => 'Special:AbuseFilter/history',
|
||||
'examine' => 'Special:AbuseFilter/examine',
|
||||
'home' => 'AbuseFilter',
|
||||
'recentchanges' => 'AbuseFilter/history',
|
||||
'examine' => 'AbuseFilter/examine',
|
||||
];
|
||||
|
||||
if ( $this->afPermissionManager->canViewAbuseLog( $user ) ) {
|
||||
$linkDefs = array_merge( $linkDefs, [
|
||||
'log' => 'Special:AbuseLog'
|
||||
] );
|
||||
$linkDefs += [
|
||||
'log' => 'AbuseLog'
|
||||
];
|
||||
}
|
||||
|
||||
if ( $this->afPermissionManager->canViewPrivateFilters( $user ) ) {
|
||||
$linkDefs = array_merge( $linkDefs, [
|
||||
'test' => 'Special:AbuseFilter/test',
|
||||
'tools' => 'Special:AbuseFilter/tools'
|
||||
] );
|
||||
$linkDefs += [
|
||||
'test' => 'AbuseFilter/test',
|
||||
'tools' => 'AbuseFilter/tools'
|
||||
];
|
||||
}
|
||||
|
||||
$links = [];
|
||||
|
@ -66,12 +66,14 @@ abstract class AbuseFilterSpecialPage extends SpecialPage {
|
|||
$msgName = "abusefilter-topnav-$name";
|
||||
|
||||
$msg = $this->msg( $msgName )->parse();
|
||||
$title = Title::newFromText( $page );
|
||||
|
||||
if ( $name === $pageType ) {
|
||||
$links[] = Xml::tags( 'strong', null, $msg );
|
||||
} else {
|
||||
$links[] = $this->getLinkRenderer()->makeLink( $title, new HtmlArmor( $msg ) );
|
||||
$links[] = $this->getLinkRenderer()->makeLink(
|
||||
new TitleValue( NS_SPECIAL, $page ),
|
||||
new HtmlArmor( $msg )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue