diff options
author | Byron Jones <bjones@mozilla.com> | 2013-09-09 08:23:58 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-09-09 08:23:58 +0200 |
commit | c9cdd836907191109c99e2680efe6aa14e0e8df0 (patch) | |
tree | cc5c2c4cb30f0eaabce583d37dcc36dc45cc3cde /extensions/Review | |
parent | 619707466974c0a6fbf5de98374e38ad7d5f5937 (diff) | |
download | bugzilla-c9cdd836907191109c99e2680efe6aa14e0e8df0.tar.gz bugzilla-c9cdd836907191109c99e2680efe6aa14e0e8df0.tar.xz |
Bug 912540: the push extension alters the flag_end_of_update hook's args for all extensions not just itself
Diffstat (limited to 'extensions/Review')
-rw-r--r-- | extensions/Review/Extension.pm | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index 842160df1..ed155bbd2 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -274,12 +274,22 @@ sub post_bug_attachment_flags { sub flag_end_of_update { my ($self, $args) = @_; - my ($attachment, $changes) = @$args{qw(object changes)}; - if (exists $changes->{'flag.review'} - && $changes->{'flag.review'}->[1] eq '?' - && $attachment->bug->product_obj->reviewer_required) - { - ThrowUserError('reviewer_required'); + my ($object, $new_flags) = @$args{qw(object new_flags)}; + my $bug = $object->isa('Bugzilla::Attachment') ? $object->bug : $object; + return unless $bug->product_obj->reviewer_required; + + foreach my $orig_change (@$new_flags) { + my $change = $orig_change; # work on a copy + $change =~ s/^[^:]+://; + my $reviewer = ''; + if ($change =~ s/\(([^\)]+)\)$//) { + $reviewer = $1; + } + my ($name, $value) = $change =~ /^(.+)(.)$/; + + if ($name eq 'review' && $value eq '?' && $reviewer eq '') { + ThrowUserError('reviewer_required'); + } } } |