protected function applyAuditors(array $phids, HeraldRule $rule) { $adapter = $this->getAdapter(); $object = $adapter->getObject(); $auditors = $object->getAudits(); $current = array(); foreach ($auditors as $auditor) { if ($auditor->isInteresting()) { $current[] = $auditor->getAuditorPHID(); } } $allowed_types = array(PhabricatorPeopleUserPHIDType::TYPECONST, PhabricatorProjectProjectPHIDType::TYPECONST, PhabricatorOwnersPackagePHIDType::TYPECONST); $targets = $this->loadStandardTargets($phids, $allowed_types, $current); if (!$targets) { return; } $phids = array_fuse(array_keys($targets)); // TODO: Convert this to be translatable, structured data eventually. $reason_map = array(); foreach ($phids as $phid) { $reason_map[$phid][] = pht('%s Triggered Audit', $rule->getMonogram()); } $xaction = $adapter->newTransaction()->setTransactionType(PhabricatorAuditActionConstants::ADD_AUDITORS)->setNewValue($phids)->setMetadataValue('auditStatus', PhabricatorAuditStatusConstants::AUDIT_REQUIRED)->setMetadataValue('auditReasonMap', $reason_map); $adapter->queueTransaction($xaction); $this->logEffect(self::DO_ADD_AUDITORS, $phids); }