Skip to content

Commit

Permalink
Replace deprecated User::isBlocked & ::newFromId (#5)
Browse files Browse the repository at this point in the history
ERM36615

Co-authored-by: hslater <[email protected]>
  • Loading branch information
HamishSlater and hslater authored Feb 4, 2025
1 parent 372071a commit 4e06777
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/BaseNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,19 @@ public function getUser() {
* @param array $users
*/
protected function addAffectedUsers( $users ) {
$services = MediaWikiServices::getInstance();
$userFactory = $services->getUserFactory();
$pm = $services->getPermissionManager();
foreach ( $users as $user ) {
if ( is_numeric( $user ) ) {
$user = User::newFromId( intval( $user ) );
$user = $userFactory->newFromId( intval( $user ) );
}
if ( !( $user instanceof User ) ) {
continue;
}
if ( $user->isBlocked() ) {
if ( $user->getBlock() ) {
continue;
}
$pm = MediaWikiServices::getInstance()->getPermissionManager();
if ( $this->title instanceof Title && !$pm->userCan( 'read', $user, $this->title ) ) {
continue;
} elseif ( !$user->isAllowed( 'read' ) ) {
Expand Down

0 comments on commit 4e06777

Please sign in to comment.