summaryrefslogtreecommitdiffstats
path: root/extensions/PhabBugz/lib/Policy.pm
diff options
context:
space:
mode:
authordklawren <dklawren@users.noreply.github.com>2018-02-13 16:25:35 +0100
committerGitHub <noreply@github.com>2018-02-13 16:25:35 +0100
commitc047bc48cec495dfba3eaf1146a91acc1e9f8d70 (patch)
tree8fdcce555347987fc9a5729e5ab516ffbc32c2ab /extensions/PhabBugz/lib/Policy.pm
parent95e5e0588df0057fbefd3a05e6203c7f8e92ab09 (diff)
downloadbugzilla-c047bc48cec495dfba3eaf1146a91acc1e9f8d70.tar.gz
bugzilla-c047bc48cec495dfba3eaf1146a91acc1e9f8d70.tar.xz
Bug 1434064 - Refactor Project.pm to use Moo for better type checking
Diffstat (limited to 'extensions/PhabBugz/lib/Policy.pm')
-rw-r--r--extensions/PhabBugz/lib/Policy.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/extensions/PhabBugz/lib/Policy.pm b/extensions/PhabBugz/lib/Policy.pm
index 3205562c3..23f04b354 100644
--- a/extensions/PhabBugz/lib/Policy.pm
+++ b/extensions/PhabBugz/lib/Policy.pm
@@ -83,9 +83,8 @@ sub new_from_query {
my ($class, $params) = @_;
my $result = request('policy.query', $params);
if (exists $result->{result}{data} && @{ $result->{result}{data} }) {
- return $result->{result}->{data}->[0];
+ return $class->new($result->{result}->{data}->[0]);
}
- return $class->new($result);
}
sub create {
@@ -105,7 +104,7 @@ sub create {
if (@$project_names) {
my $project_phids = [];
foreach my $project_name (@$project_names) {
- my $project = Bugzilla::Extension::PhabBugz::Project->new({ name => $project_name });
+ my $project = Bugzilla::Extension::PhabBugz::Project->new_from_query({ name => $project_name });
push @$project_phids, $project->phid if $project;
}
@@ -134,7 +133,7 @@ sub _build_rule_projects {
return [
map { $_->name }
grep { $_ }
- map { Bugzilla::Extension::PhabBugz::Project->new( { phids => [$_] } ) }
+ map { Bugzilla::Extension::PhabBugz::Project->new_from_query( { phids => [$_] } ) }
@{ $rule->{value} }
];
}