]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Code Pull requests 33 Insights Settings Bug 1452531 - PhabBugz code should add allow...
authordklawren <dklawren@users.noreply.github.com>
Fri, 20 Apr 2018 16:57:40 +0000 (12:57 -0400)
committerDylan William Hardison <dylan@hardison.net>
Fri, 20 Apr 2018 16:57:40 +0000 (12:57 -0400)
extensions/PhabBugz/lib/Feed.pm
extensions/PhabBugz/lib/Policy.pm
extensions/PhabBugz/lib/Util.pm
extensions/Push/lib/Connector/Phabricator.pm

index a51f240a835f3c9985d5d8ff446b67deb8abac58..2904e9dede69e77e92448ebf68c1543608aa21fb 100644 (file)
@@ -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');
index 8162ac52cb1809cf9c51c6bc27ba73f8c5775972..0beecc8e1347f720cd13ee651fa759a2fd97d5c1 100644 (file)
@@ -97,6 +97,10 @@ sub create {
             {
                 action => 'allow',
                 rule   => 'PhabricatorSubscriptionsSubscribersPolicyRule',
+            },
+            {
+                action => 'allow',
+                rule   => 'PhabricatorDifferentialReviewersPolicyRule'
             }
         ]
     };
index cd396602e0bd7aa55facc5758b84b0577e7a2ade..a640f52a1f97971a9eb52393f813f57e4256219e 100644 (file)
@@ -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
index 5da64901af322333979d96668fcc0a7cd82b40a1..1878834a921e183ba485e92fdd8f0fced4adf09b 100644 (file)
@@ -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;