]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1556836 - Feed daemon needs to add security-revision and bmo security tags back...
authordklawren <dklawren@users.noreply.github.com>
Thu, 13 Jun 2019 16:11:39 +0000 (12:11 -0400)
committerGitHub <noreply@github.com>
Thu, 13 Jun 2019 16:11:39 +0000 (12:11 -0400)
extensions/PhabBugz/lib/Feed.pm
extensions/PhabBugz/lib/Revision.pm

index df0b61e49fce0f75779cb898e2e06b4fbe5a7103..447875fcc9b6c167fff21ed51703abb31daf01c5 100644 (file)
@@ -447,6 +447,9 @@ sub process_revision_change {
       $revision->make_private($set_project_names);
     }
 
+    # Always make sure secure-revison and proper bmo-<group> project tags are on the revision.
+    $revision->set_private_project_tags($set_project_names);
+
     # Subscriber list of the private revision should always match
     # the bug roles such as assignee, qa contact, and cc members.
     my $subscribers = get_bug_role_phids($bug);
index 3ec844aff51678bf0c32e65076d654f7cb23144e..e3924eefba93b1c99f926bbc445607ebbf5f1436 100644 (file)
@@ -433,15 +433,10 @@ sub remove_project {
 sub make_private {
   my ($self, $project_names) = @_;
 
-  my $secure_revision_project
-    = Bugzilla::Extension::PhabBugz::Project->new_from_query({
-    name => 'secure-revision'
-    });
-
   my @set_projects;
   foreach my $name (@$project_names) {
-    my $set_project
-      Bugzilla::Extension::PhabBugz::Project->new_from_query({name => $name});
+    my $set_project = $self->{"_project_${name}"} ||=
+      Bugzilla::Extension::PhabBugz::Project->new_from_query({name => $name});
     push @set_projects, $set_project;
   }
 
@@ -449,18 +444,14 @@ sub make_private {
   $self->set_policy('view', $new_policy->phid);
   $self->set_policy('edit', $new_policy->phid);
 
-  foreach my $project ($secure_revision_project, @set_projects) {
-    $self->add_project($project->phid);
-  }
-
   return $self;
 }
 
 sub make_public {
   my ($self) = @_;
 
-  my $editbugs
-    Bugzilla::Extension::PhabBugz::Project->new_from_query({
+  my $editbugs = $self->{'_project_bmo-editbugs-team'} ||=
+    Bugzilla::Extension::PhabBugz::Project->new_from_query({
     name => 'bmo-editbugs-team'
     });
 
@@ -476,4 +467,24 @@ sub make_public {
   return $self;
 }
 
+sub set_private_project_tags {
+  my ($self, $project_names) = @_;
+
+  my $secure_revision_project = $self->{'_project_secure-revision'} ||=
+    Bugzilla::Extension::PhabBugz::Project->new_from_query({
+    name => 'secure-revision'
+    });
+
+  my @set_projects;
+  foreach my $name (@$project_names) {
+    my $set_project = $self->{"_project_${name}"} ||=
+      Bugzilla::Extension::PhabBugz::Project->new_from_query({name => $name});
+    push @set_projects, $set_project;
+  }
+
+  foreach my $project ($secure_revision_project, @set_projects) {
+    $self->add_project($project->phid);
+  }
+}
+
 1;