summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xattachment.cgi2
-rw-r--r--extensions/Review/Extension.pm18
2 files changed, 18 insertions, 2 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 94d43462d..cb0d581b3 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -578,7 +578,7 @@ sub insert {
}
# BMO - allow pre-processing of attachment flags
- Bugzilla::Hook::process('create_attachment_flags', { bug => $bug });
+ Bugzilla::Hook::process('create_attachment_flags', { bug => $bug, attachment => $attachment });
my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi(
$bug, $attachment, $vars, SKIP_REQUESTEE_ON_ERROR);
$attachment->set_flags($flags, $new_flags);
diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm
index 07f1f66c0..80841dfb1 100644
--- a/extensions/Review/Extension.pm
+++ b/extensions/Review/Extension.pm
@@ -514,7 +514,7 @@ sub create_attachment_flags {
sub _check_review_flag {
my ($self, $args) = @_;
- my $bug = $args->{bug};
+ my ($bug, $attachment) = @$args{qw( bug attachment )};
my $cgi = Bugzilla->cgi;
# extract the set flag-types
@@ -552,6 +552,22 @@ sub _check_review_flag {
if (scalar(@$users) > 1) {
ThrowUserError('user_match_too_many', { fields => [ 'review' ] });
}
+
+ # we want to throw an error if the requestee does not have access
+ # to the bug. bugzilla's default behaviour is to sliently drop the
+ # requestee, which results in a confusing 'reviewer required'
+ # error.
+ # fake it by creating a flag and try to set the requestee.
+ # bugzilla's flags don't have a normal constructor or property
+ # setters, so we have to bless it directly then call the internal
+ # check_requestee method. urgh.
+ my $flag = bless({
+ type_id => $flag_type->id,
+ status => '?',
+ bug_id => $bug->id,
+ attach_id => $attachment->id
+ }, 'Bugzilla::Flag');
+ $flag->_check_requestee($reviewer, $bug, $attachment);
}
}
}