summaryrefslogtreecommitdiffstats
path: root/extensions/Review
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-03-30 06:43:40 +0200
committerByron Jones <glob@mozilla.com>2015-03-30 06:43:40 +0200
commit9a07ea292800bf33eb660f893de8a2d89569541d (patch)
tree148c4ee44471447c3c87e695bebf97edca05f10c /extensions/Review
parent31e3b4eaea38384089f0cf6f268d4b513d23be59 (diff)
downloadbugzilla-9a07ea292800bf33eb660f893de8a2d89569541d.tar.gz
bugzilla-9a07ea292800bf33eb660f893de8a2d89569541d.tar.xz
Bug 1125987: asking for review in a restricted bug doesn't work as expected ("You must provide a reviewer for review requests" instead of "That user cannot access that bug" error)
Diffstat (limited to 'extensions/Review')
-rw-r--r--extensions/Review/Extension.pm18
1 files changed, 17 insertions, 1 deletions
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);
}
}
}