diff options
Diffstat (limited to 'extensions/PhabBugz')
-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 |
3 files changed, 17 insertions, 9 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 |