mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Draw project PHIDs from repositories when evaluating Herald object rules for commits
Summary: Fixes T12097. In D16413, I simplified this code but caused us to load the //commit's// projects instead of the //repository's// projects, which is incorrect. Normally, commits don't have any project tags when Herald evaluates, so using the commit's projects is generally meaningless. Test Plan: - Tagged a repository with `#X`. - Created a Herald object rule for commits with `#X` as the object ("Always ... do nothing.") - Ran a commit from the repository. - Before patch: rule failed to evaluate. - After patch: rule evaluated and passed. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12097 Differential Revision: https://secure.phabricator.com/D17179
This commit is contained in:
parent
7ff0be1bde
commit
a27c824da6
1 changed files with 20 additions and 6 deletions
|
@ -104,12 +104,26 @@ final class HeraldCommitAdapter
|
|||
public function getTriggerObjectPHIDs() {
|
||||
$project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
|
||||
|
||||
return array_merge(
|
||||
array(
|
||||
$this->getRepository()->getPHID(),
|
||||
$this->getPHID(),
|
||||
),
|
||||
$this->loadEdgePHIDs($project_type));
|
||||
$repository_phid = $this->getRepository()->getPHID();
|
||||
$commit_phid = $this->getObject()->getPHID();
|
||||
|
||||
$phids = array();
|
||||
$phids[] = $commit_phid;
|
||||
$phids[] = $repository_phid;
|
||||
|
||||
// NOTE: This is projects for the repository, not for the commit. When
|
||||
// Herald evalutes, commits normally can not have any project tags yet.
|
||||
$repository_project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$repository_phid,
|
||||
$project_type);
|
||||
foreach ($repository_project_phids as $phid) {
|
||||
$phids[] = $phid;
|
||||
}
|
||||
|
||||
$phids = array_unique($phids);
|
||||
$phids = array_values($phids);
|
||||
|
||||
return $phids;
|
||||
}
|
||||
|
||||
public function explainValidTriggerObjects() {
|
||||
|
|
Loading…
Reference in a new issue