mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-23 21:53:40 +00:00
Merge "Make use of ?? operators in TitleBlacklist::isBlacklisted"
This commit is contained in:
commit
8e6bd0ab08
|
@ -219,29 +219,26 @@ class TitleBlacklist {
|
|||
public function isBlacklisted( $title, $action = 'edit' ) {
|
||||
if ( !( $title instanceof Title ) ) {
|
||||
$title = Title::newFromText( $title );
|
||||
if ( !( $title instanceof Title ) ) {
|
||||
if ( !$title ) {
|
||||
// The fact that the page name is invalid will stop whatever
|
||||
// action is going through. No sense in doing more work here.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$blacklist = $this->getBlacklist();
|
||||
$autoconfirmedItem = false;
|
||||
foreach ( $blacklist as $item ) {
|
||||
|
||||
$autoconfirmedItem = null;
|
||||
foreach ( $this->getBlacklist() as $item ) {
|
||||
if ( $item->matches( $title->getFullText(), $action ) ) {
|
||||
if ( $this->isWhitelisted( $title, $action ) ) {
|
||||
return false;
|
||||
}
|
||||
$params = $item->getParams();
|
||||
if ( !isset( $params['autoconfirmed'] ) ) {
|
||||
if ( !isset( $item->getParams()['autoconfirmed'] ) ) {
|
||||
return $item;
|
||||
}
|
||||
if ( !$autoconfirmedItem ) {
|
||||
$autoconfirmedItem = $item;
|
||||
}
|
||||
$autoconfirmedItem ??= $item;
|
||||
}
|
||||
}
|
||||
return $autoconfirmedItem;
|
||||
return $autoconfirmedItem ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue