diff options
author | David Walsh <davidwalsh83@gmail.com> | 2017-10-10 16:43:45 +0200 |
---|---|---|
committer | dklawren <dklawren@users.noreply.github.com> | 2017-10-10 16:43:45 +0200 |
commit | 191a5fc2fbdba570d4d3b69a944dcec3366973b5 (patch) | |
tree | 9dc40955f59994faadfbf51ec3acc5d29f940299 /extensions/PhabBugz/lib/WebService.pm | |
parent | 3e1b339cebc0f5259027e266f98f9b06f83f53a3 (diff) | |
download | bugzilla-191a5fc2fbdba570d4d3b69a944dcec3366973b5.tar.gz bugzilla-191a5fc2fbdba570d4d3b69a944dcec3366973b5.tar.xz |
Bug 1399593 - Add sync group comments during new revision creation as well as push connector
Diffstat (limited to 'extensions/PhabBugz/lib/WebService.pm')
-rw-r--r-- | extensions/PhabBugz/lib/WebService.pm | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/extensions/PhabBugz/lib/WebService.pm b/extensions/PhabBugz/lib/WebService.pm index 4b14f1495..738077880 100644 --- a/extensions/PhabBugz/lib/WebService.pm +++ b/extensions/PhabBugz/lib/WebService.pm @@ -25,6 +25,7 @@ use Bugzilla::WebService::Constants; use Bugzilla::Extension::PhabBugz::Constants; use Bugzilla::Extension::PhabBugz::Util qw( + add_security_sync_comments create_revision_attachment create_private_revision_policy edit_revision_policy @@ -35,6 +36,7 @@ use Bugzilla::Extension::PhabBugz::Util qw( is_attachment_phab_revision make_revision_public request + get_security_sync_groups ); use List::Util qw(first); @@ -80,7 +82,7 @@ sub revision { my $revision_title = $revision->{fields}{title} || 'Unknown Description'; my $bug_id = $revision->{fields}{'bugzilla.bug-id'}; - my $bug = Bugzilla::Bug->check($bug_id); + my $bug = Bugzilla::Bug->new($bug_id); # If bug is public then remove privacy policy my $result; @@ -89,19 +91,12 @@ sub revision { } # else bug is private else { - my $phab_sync_groups = Bugzilla->params->{phabricator_sync_groups} - || ThrowUserError('invalid_phabricator_sync_groups'); - my $sync_group_names = [ split('[,\s]+', $phab_sync_groups) ]; - - my $bug_groups = $bug->groups_in; - my $bug_group_names = [ map { $_->name } @$bug_groups ]; - - my @set_groups = intersect($bug_group_names, $sync_group_names); + my @set_groups = get_security_sync_groups($bug); # If bug privacy groups do not have any matching synchronized groups, # then leave revision private and it will have be dealt with manually. if (!@set_groups) { - ThrowUserError('invalid_phabricator_sync_groups'); + add_security_sync_comments(\@revisions, $bug); } my $policy_phid = create_private_revision_policy($bug, \@set_groups); |