Don't send email notifs to blocked users if $wgBlockDisablesLogin is true

Bug: T199993
Change-Id: I47ed3599d61ca8177cdd0820dea4089fdb087d82
This commit is contained in:
Roan Kattouw 2018-08-22 15:09:30 -07:00
parent 7f48cfbdb9
commit 2b0929a4b1

View file

@ -31,13 +31,18 @@ class EchoNotifier {
* @return bool
*/
public static function notifyWithEmail( $user, $event ) {
global $wgEnableEmail;
global $wgEnableEmail, $wgBlockDisablesLogin;
if ( !$wgEnableEmail ) {
return false;
}
// No valid email address or email notification
if ( !$user->isEmailConfirmed() || $user->getOption( 'echo-email-frequency' ) < 0 ) {
if (
// Email is globally disabled
!$wgEnableEmail ||
// User does not have a valid and confirmed email address
!$user->isEmailConfirmed() ||
// User has disabled Echo emails
$user->getOption( 'echo-email-frequency' ) < 0 ||
// User is blocked and cannot log in (T199993)
( $wgBlockDisablesLogin && $user->isBlocked() )
) {
return false;
}