mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-24 15:52:41 +01:00
545dad319e
Summary: Fixes T5889. You can't write a rule like "if no other Herald rules did anything...", but you can use this rule to check for Owners or an explicit "Auditors" field doing things. Test Plan: Using the test console, ran an "Auditors" rule against a commit with and without an auditor. Got expected pass/fail outcomes. Reviewers: chad Reviewed By: chad Maniphest Tasks: T5889 Differential Revision: https://secure.phabricator.com/D17221
41 lines
892 B
PHP
41 lines
892 B
PHP
<?php
|
|
|
|
final class DiffusionCommitAuditorsHeraldField
|
|
extends DiffusionCommitHeraldField {
|
|
|
|
const FIELDCONST = 'diffusion.commit.auditors';
|
|
|
|
public function getHeraldFieldName() {
|
|
return pht('Auditors');
|
|
}
|
|
|
|
public function getHeraldFieldValue($object) {
|
|
$viewer = PhabricatorUser::getOmnipotentUser();
|
|
|
|
$commit = id(new DiffusionCommitQuery())
|
|
->setViewer($viewer)
|
|
->withPHIDs(array($object->getPHID()))
|
|
->needAuditRequests(true)
|
|
->executeOne();
|
|
|
|
$audits = $commit->getAudits();
|
|
|
|
$phids = array();
|
|
foreach ($audits as $audit) {
|
|
if ($audit->isActiveAudit()) {
|
|
$phids[] = $audit->getAuditorPHID();
|
|
}
|
|
}
|
|
|
|
return $phids;
|
|
}
|
|
|
|
protected function getHeraldFieldStandardType() {
|
|
return self::STANDARD_PHID_LIST;
|
|
}
|
|
|
|
protected function getDatasource() {
|
|
return new DiffusionAuditorDatasource();
|
|
}
|
|
|
|
}
|