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
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');
}
sub create_private_revision_policy {
- my ($bug, $groups) = @_;
+ my ( $groups ) = @_;
my $data = {
objectType => 'DREV',
policy => [
{
action => 'allow',
- rule => 'PhabricatorSubscriptionsSubscribersPolicyRule',
+ rule => 'PhabricatorSubscriptionsSubscribersPolicyRule'
+ },
+ {
+ action => 'allow',
+ rule => 'PhabricatorDifferentialReviewersPolicyRule'
}
]
};
],
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
$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;