diff options
author | dklawren <dklawren@users.noreply.github.com> | 2018-04-20 18:57:40 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-04-20 18:57:40 +0200 |
commit | 5b0812a368b9e646f393ccbf62186ed1b2b535d2 (patch) | |
tree | 515f86ced4ec8f1221b8141c31ff859a8c22d6c7 | |
parent | 90150e46031cabbe94239820e5010fb88200d52b (diff) | |
download | bugzilla-5b0812a368b9e646f393ccbf62186ed1b2b535d2.tar.gz bugzilla-5b0812a368b9e646f393ccbf62186ed1b2b535d2.tar.xz |
Code Pull requests 33 Insights Settings Bug 1452531 - PhabBugz code should add allow visibility to reviewers when creating custom policies
-rw-r--r-- | extensions/PhabBugz/lib/Feed.pm | 3 | ||||
-rw-r--r-- | extensions/PhabBugz/lib/Policy.pm | 4 | ||||
-rw-r--r-- | extensions/PhabBugz/lib/Util.pm | 19 | ||||
-rw-r--r-- | extensions/Push/lib/Connector/Phabricator.pm | 2 |
4 files changed, 18 insertions, 10 deletions
diff --git a/extensions/PhabBugz/lib/Feed.pm b/extensions/PhabBugz/lib/Feed.pm index a51f240a8..2904e9ded 100644 --- a/extensions/PhabBugz/lib/Feed.pm +++ b/extensions/PhabBugz/lib/Feed.pm @@ -28,7 +28,6 @@ use Bugzilla::Extension::PhabBugz::User; use Bugzilla::Extension::PhabBugz::Util qw( add_security_sync_comments create_revision_attachment - edit_revision_policy get_bug_role_phids get_phab_bmo_ids get_project_phid @@ -253,7 +252,7 @@ sub process_revision_change { my ($added, $removed) = diff_arrays($current_projects, \@set_projects); if (@$added || @$removed) { DEBUG('Project groups do not match. Need new custom policy'); - $current_policy= undef; + $current_policy = undef; } else { DEBUG('Project groups match. Leaving current policy as-is'); diff --git a/extensions/PhabBugz/lib/Policy.pm b/extensions/PhabBugz/lib/Policy.pm index 8162ac52c..0beecc8e1 100644 --- a/extensions/PhabBugz/lib/Policy.pm +++ b/extensions/PhabBugz/lib/Policy.pm @@ -97,6 +97,10 @@ sub create { { action => 'allow', rule => 'PhabricatorSubscriptionsSubscribersPolicyRule', + }, + { + action => 'allow', + rule => 'PhabricatorDifferentialReviewersPolicyRule' } ] }; diff --git a/extensions/PhabBugz/lib/Util.pm b/extensions/PhabBugz/lib/Util.pm index cd396602e..a640f52a1 100644 --- a/extensions/PhabBugz/lib/Util.pm +++ b/extensions/PhabBugz/lib/Util.pm @@ -136,7 +136,7 @@ sub get_bug_role_phids { } sub create_private_revision_policy { - my ($bug, $groups) = @_; + my ( $groups ) = @_; my $data = { objectType => 'DREV', @@ -144,7 +144,11 @@ sub create_private_revision_policy { policy => [ { action => 'allow', - rule => 'PhabricatorSubscriptionsSubscribersPolicyRule', + rule => 'PhabricatorSubscriptionsSubscribersPolicyRule' + }, + { + action => 'allow', + rule => 'PhabricatorDifferentialReviewersPolicyRule' } ] }; @@ -197,24 +201,25 @@ sub make_revision_public { ], objectIdentifier => $revision_phid }); + } sub make_revision_private { my ($revision_phid) = @_; - my $secure_revision = Bugzilla::Extension::PhabBugz::Project->new_from_query({ - name => 'secure-revision' - }); + # When creating a private policy with no args it + # creates one with the secure-revision project. + my $private_policy = create_private_revision_policy(); return request('differential.revision.edit', { transactions => [ { type => "view", - value => $secure_revision->phid + value => $private_policy->phid }, { type => "edit", - value => $secure_revision->phid + value => $private_policy->phid } ], objectIdentifier => $revision_phid diff --git a/extensions/Push/lib/Connector/Phabricator.pm b/extensions/Push/lib/Connector/Phabricator.pm index 5da64901a..1878834a9 100644 --- a/extensions/Push/lib/Connector/Phabricator.pm +++ b/extensions/Push/lib/Connector/Phabricator.pm @@ -128,7 +128,7 @@ sub send { $revision->{id}, $bug->id )); - my $policy_phid = create_private_revision_policy( $bug, \@set_groups ); + my $policy_phid = create_private_revision_policy( \@set_groups ); edit_revision_policy( $revision_phid, $policy_phid, $subscribers ); $rev_obj->add_project($secure_project_phid); $revision_updated = 1; |