Improve removal of "hide registered users" option on Special:NewPages

Don't remove the option if anonymous users can create talk pages.

Bug: T238483
Change-Id: Ia8e555f18c713259b71ce8b88a109f94902d361a
This commit is contained in:
DannyS712 2019-11-17 03:46:37 +00:00
parent 52d9ddc4f2
commit 9ef34a2f1d

View file

@ -188,9 +188,7 @@ class SpecialNewpages extends IncludableSpecialPage {
}
// Disable some if needed
if ( !MediaWikiServices::getInstance()->getPermissionManager()
->groupHasPermission( '*', 'createpage' )
) {
if ( !$this->canAnonymousUsersCreatePages() ) {
unset( $filters['hideliu'] );
}
if ( !$this->getUser()->useNPPatrol() ) {
@ -544,6 +542,13 @@ class SpecialNewpages extends IncludableSpecialPage {
nl2br( htmlspecialchars( $content->serialize() ) ) . "</div>";
}
private function canAnonymousUsersCreatePages() {
$pm = MediaWikiServices::getInstance()->getPermissionManager();
return ( $pm->groupHasPermission( '*', 'createpage' ) ||
$pm->groupHasPermission( '*', 'createtalk' )
);
}
protected function getGroupName() {
return 'changes';
}