diff options
author | Byron Jones <glob@mozilla.com> | 2015-05-22 07:29:03 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-05-22 07:29:03 +0200 |
commit | b09be15c170b39ec2c1553efcfd8f795e4847ad5 (patch) | |
tree | 968f07100194ed8b7dfdac7093fac4aec8b5e069 /extensions | |
parent | 216b28df38a104e5c119e4ea4f968e7360bd817e (diff) | |
download | bugzilla-b09be15c170b39ec2c1553efcfd8f795e4847ad5.tar.gz bugzilla-b09be15c170b39ec2c1553efcfd8f795e4847ad5.tar.xz |
Bug 1166623: move MAX_REVIEWER_LAST_SEEN_DAYS_AGO from a constant to a parameter
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/Review/Extension.pm | 23 | ||||
-rw-r--r-- | extensions/Review/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl | 16 |
2 files changed, 31 insertions, 8 deletions
diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index 0fdd22e4e..8a6835e8f 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -13,6 +13,7 @@ use base qw(Bugzilla::Extension); our $VERSION = '1'; use Bugzilla; +use Bugzilla::Config::Common qw(check_numeric); use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Extension::Review::FlagStateActivity; @@ -25,11 +26,6 @@ use Bugzilla::Util qw(clean_text datetime_from); use constant UNAVAILABLE_RE => qr/\b(?:unavailable|pto|away)\b/i; -# This extension prevents you from assigning reviews to inactive reviewers, -# with this constant defining 'inactive'. Set the value to 0 to disable this -# prevention. -use constant MAX_REVIEWER_LAST_SEEN_DAYS_AGO => 60; - # # monkey-patched methods # @@ -94,13 +90,13 @@ sub _reviewers_objs { sub _user_is_active { my ($self) = @_; - return 1 if MAX_REVIEWER_LAST_SEEN_DAYS_AGO == 0; # feature disabled + return 1 unless Bugzilla->params->{max_reviewer_last_seen}; return 0 if !defined($self->last_seen_date); my $dt = datetime_from($self->last_seen_date); my $days_ago = $dt->delta_days(DateTime->now())->in_units('days'); - return $days_ago <= MAX_REVIEWER_LAST_SEEN_DAYS_AGO; + return $days_ago <= Bugzilla->params->{max_reviewer_last_seen}; } sub _user_review_count { @@ -618,7 +614,7 @@ sub flag_end_of_update { if (!$reviewer_obj->is_active) { ThrowUserError('reviewer_inactive', { reviewer => $reviewer_obj, - timeout => MAX_REVIEWER_LAST_SEEN_DAYS_AGO + timeout => Bugzilla->params->{max_reviewer_last_seen} }); } } @@ -1044,4 +1040,15 @@ sub install_before_final_checks { add_setting('block_reviews', ['on', 'off'], 'off'); } +sub config_modify_panels { + my ($self, $args) = @_; + push @{ $args->{panels}->{advanced}->{params} }, { + name => 'max_reviewer_last_seen', + type => 't', + default => '', + default => 0, + checker => \&check_numeric, + }; +} + __PACKAGE__->NAME; diff --git a/extensions/Review/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl b/extensions/Review/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl new file mode 100644 index 000000000..186b2fb6f --- /dev/null +++ b/extensions/Review/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl @@ -0,0 +1,16 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + +[% IF panel.name == "advanced" %] + [% panel.param_descs.max_reviewer_last_seen = + 'Users must have logged into Bugzilla within this number of days before they ' _ + 'are allowed to be set as the requestee for the review flag. This ensures ' _ + 'idle/absent people are not asked to review code. Set this to 0 to disable ' _ + 'this feature.' + %] +[% END -%] |