summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Push/Extension.pm6
-rw-r--r--extensions/Review/Extension.pm22
2 files changed, 19 insertions, 9 deletions
diff --git a/extensions/Push/Extension.pm b/extensions/Push/Extension.pm
index ff7f21295..d38dcb032 100644
--- a/extensions/Push/Extension.pm
+++ b/extensions/Push/Extension.pm
@@ -223,8 +223,6 @@ sub _morph_flag_updates {
my @removed = _morph_flag_update($args->{'old_flags'});
my @added = _morph_flag_update($args->{'new_flags'});
- delete $args->{'old_flags'};
- delete $args->{'new_flags'};
my $changes = {};
foreach my $ra (@removed, @added) {
@@ -251,7 +249,8 @@ sub _morph_flag_updates {
sub _morph_flag_update {
my ($values) = @_;
my @result;
- foreach my $change (@$values) {
+ foreach my $orig_change (@$values) {
+ my $change = $orig_change; # work on a copy
$change =~ s/^[^:]+://;
my $requestee = '';
if ($change =~ s/\(([^\)]+)\)$//) {
@@ -371,6 +370,7 @@ sub flag_end_of_update {
return unless $self->_enabled;
_morph_flag_updates($args);
$self->_object_modified($args);
+ delete $args->{changes};
}
# comments in bugzilla 4.0 doesn't aren't included in the bug_end_of_* hooks,
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');
+ }
}
}