Skip to content

Commit

Permalink
Merge REL1_42 (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 authored Sep 22, 2024
1 parent dc5ceca commit 7ba08a3
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions includes/HookHandlers/SpamEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,33 @@ public function onIsValidEmailAddr( $addr, &$result ) {
$match = preg_match( $regex, $addr );
AtEase::restoreWarnings();
if ( $match ) {
$result = false;
return false;
}
}

// Check email addresses of block users
$dbr = $this->loadBalancer->getConnection( DB_REPLICA );
$emails = array_filter( array_unique( array_map(
static function ( $block ) use ( $dbr ) {
$id = $block->getBlocker();
if ( $id ) {
return User::newFromIdentity( $id )->getEmail();
static function ( $block ) {
if ( wfTimestampNow() > $block->getExpiry() ) {
return null;
}
$target = $block->getTargetUserIdentity();
if ( $target == null ) {
return null;
}
$target = User::newFromIdentity( $target );
if ( $target ) {
return $target->getEmail();
}
return null;
},
$this->databaseBlockStore->newListFromConds( [ $dbr->expr( 'bt_user', '!=', null ) ] )
$this->databaseBlockStore->newListFromConds( [] )
) ) );
if ( in_array( $addr, $emails ) ) {
$result = false;
return false;
}
return true;
}
}

0 comments on commit 7ba08a3

Please sign in to comment.