From 1146dfffe7569ec677fd03c47b2a0447cf5b74ff Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 27 Jul 2015 12:56:59 +0800 Subject: Bug 1186788 - disabling an account should always disable bugmail --- Bugzilla/User.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index a749aaaf2..fe48e4bf2 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -277,8 +277,9 @@ sub update { ################################################################################ sub _check_disable_mail { - return 1 unless $_[0]->is_enabled; - return $_[1] ? 1 : 0; + my ($invocant, $value) = @_; + return 1 if ref($invocant) && !$invocant->is_enabled; + return $value ? 1 : 0; } sub _check_disabledtext { return trim($_[1]) || ''; } @@ -2219,6 +2220,15 @@ sub create { return $user; } +sub check_required_create_fields { + my ($invocant, $params) = @_; + # ensure disabled users also have their email disabled + $params->{disable_mail} = 1 if + exists $params->{disabledtext} + && defined($params->{disabledtext}) + && trim($params->{disabledtext}) ne ''; +} + ########################### # Account Lockout Methods # ########################### -- cgit v1.2.3-24-g4f1b