1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

Fix two issues in owners worker

Summary:
Fix two issues in PhabricatorRepositoryCommitOwnersWorker:

- if a commit was reviewed by some owner of the package, it should not be
  marked as needing audit
- do not run herald worker when it is not needed (for example, when the
  worker is executed from reparse.php)

Test Plan:
reparse a commit which is reviewed by the owner of a package
and verify that it is not marked as needing audit, and herald is not
executed.

Reviewers: nh, epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1496
This commit is contained in:
Jason Ge 2012-01-26 10:43:10 -08:00
parent 3e15d7b3df
commit b4053190ec

View file

@ -36,7 +36,7 @@ class PhabricatorRepositoryCommitOwnersWorker
$package->getPHID(),
$commit->getPHID());
// Don't update relationship if it exists already
// Don't update relationship if it exists already
if (!$relationship) {
if ($package->getAuditingEnabled()) {
$reasons = $this->checkAuditReasons($commit, $package);
@ -63,13 +63,15 @@ class PhabricatorRepositoryCommitOwnersWorker
}
}
$herald_task = new PhabricatorWorkerTask();
$herald_task->setTaskClass('PhabricatorRepositoryCommitHeraldWorker');
$herald_task->setData(
array(
'commitID' => $commit->getID(),
));
$herald_task->save();
if ($this->shouldQueueFollowupTasks()) {
$herald_task = new PhabricatorWorkerTask();
$herald_task->setTaskClass('PhabricatorRepositoryCommitHeraldWorker');
$herald_task->setData(
array(
'commitID' => $commit->getID(),
));
$herald_task->save();
}
}
private function checkAuditReasons(
@ -117,7 +119,7 @@ class PhabricatorRepositoryCommitOwnersWorker
$owners_phids = mpull($owners, 'getUserPHID');
if (!($commit_author_phid && in_array($commit_author_phid, $owners_phids) ||
$revision_author_phid && in_array($revision_author_phid,
$commit_reviewedby_phid && in_array($commit_reviewedby_phid,
$owners_phids))) {
$reasons[] = "Owners Not Involved";
}