diff options
author | Dylan Hardison <dylan@mozilla.com> | 2016-04-28 01:40:01 +0200 |
---|---|---|
committer | Dylan Hardison <dylan@mozilla.com> | 2016-04-28 01:40:22 +0200 |
commit | 977dfb52f737e62cf67728fe95dccff1f0ef4739 (patch) | |
tree | 31ff6a8fa438129a2b356dc961b7dc2da25325c0 /extensions | |
parent | 6b76c8f70b4d56ed5b63db10511b6a808ebe3e70 (diff) | |
download | bugzilla-977dfb52f737e62cf67728fe95dccff1f0ef4739.tar.gz bugzilla-977dfb52f737e62cf67728fe95dccff1f0ef4739.tar.xz |
Bug 1256051 - Allow MozReview.attachments() to post mozreview-* tags without requiring editbugs
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/MozReview/lib/WebService.pm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/extensions/MozReview/lib/WebService.pm b/extensions/MozReview/lib/WebService.pm index 947e65815..8f9d3215b 100644 --- a/extensions/MozReview/lib/WebService.pm +++ b/extensions/MozReview/lib/WebService.pm @@ -21,7 +21,7 @@ use Bugzilla::WebService::Constants; use Bugzilla::WebService::Util qw(extract_flags validate translate); use Bugzilla::Util qw(trim); -use List::MoreUtils qw(uniq); +use List::MoreUtils qw(uniq all); use List::Util qw(max); use Storable qw(dclone); @@ -62,12 +62,19 @@ sub attachments { if ($comment_tags) { ThrowUserError('comment_tag_disabled') unless Bugzilla->params->{comment_taggers_group}; - ThrowUserError('auth_failure', - { group => Bugzilla->params->{comment_taggers_group}, - action => 'update', - object => 'comment_tags' }) - unless $user->can_tag_comments; - $bug->set_all({ comment_tags => $comment_tags }); + + my $all_mozreview_tags = all { /^mozreview-?/i } @$comment_tags; + if ($all_mozreview_tags || $user->can_tag_comments) { + # there should be a method of User that does this. + local $user->{can_tag_comments} = 1; + $bug->set_all({ comment_tags => $comment_tags }); + } + else { + ThrowUserError('auth_failure', + { group => Bugzilla->params->{comment_taggers_group}, + action => 'update', + object => 'comment_tags' }) + } } foreach my $attachment (@$attachments) { |