Changeset View
Changeset View
Standalone View
Standalone View
src/applications/audit/editor/PhabricatorAuditEditor.php
| <?php | <?php | ||||
| final class PhabricatorAuditEditor | final class PhabricatorAuditEditor | ||||
| extends PhabricatorApplicationTransactionEditor { | extends PhabricatorApplicationTransactionEditor { | ||||
| const MAX_FILES_SHOWN_IN_EMAIL = 1000; | const MAX_FILES_SHOWN_IN_EMAIL = 1000; | ||||
| private $auditReasonMap = array(); | private $auditReasonMap = array(); | ||||
| private $affectedFiles; | private $affectedFiles; | ||||
| private $rawPatch; | private $rawPatch; | ||||
| private $auditorPHIDs = array(); | private $auditorPHIDs = array(); | ||||
| private $didExpandInlineState = false; | private $didExpandInlineState = false; | ||||
| private $oldAuditStatus = null; | |||||
| public function addAuditReason($phid, $reason) { | public function addAuditReason($phid, $reason) { | ||||
| if (!isset($this->auditReasonMap[$phid])) { | if (!isset($this->auditReasonMap[$phid])) { | ||||
| $this->auditReasonMap[$phid] = array(); | $this->auditReasonMap[$phid] = array(); | ||||
| } | } | ||||
| $this->auditReasonMap[$phid][] = $reason; | $this->auditReasonMap[$phid][] = $reason; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | protected function expandTransactions( | ||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
| case PhabricatorTransactions::TYPE_INLINESTATE: | case PhabricatorTransactions::TYPE_INLINESTATE: | ||||
| $this->didExpandInlineState = true; | $this->didExpandInlineState = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| $this->oldAuditStatus = $object->getAuditStatus(); | |||||
| $object->loadAndAttachAuditAuthority( | $object->loadAndAttachAuditAuthority( | ||||
| $this->getActor(), | $this->getActor(), | ||||
| $this->getActingAsPHID()); | $this->getActingAsPHID()); | ||||
| return parent::expandTransactions($object, $xactions); | return parent::expandTransactions($object, $xactions); | ||||
| } | } | ||||
| protected function transactionHasEffect( | protected function transactionHasEffect( | ||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | protected function applyFinalEffects( | ||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
| case PhabricatorAuditTransaction::TYPE_COMMIT: | case PhabricatorAuditTransaction::TYPE_COMMIT: | ||||
| $import_status_flag = PhabricatorRepositoryCommit::IMPORTED_HERALD; | $import_status_flag = PhabricatorRepositoryCommit::IMPORTED_HERALD; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| $old_status = $object->getAuditStatus(); | $old_status = $this->oldAuditStatus; | ||||
| $requests = $object->getAudits(); | $requests = $object->getAudits(); | ||||
| $object->updateAuditStatus($requests); | $object->updateAuditStatus($requests); | ||||
| $new_status = $object->getAuditStatus(); | $new_status = $object->getAuditStatus(); | ||||
| $object->save(); | $object->save(); | ||||
| ▲ Show 20 Lines • Show All 598 Lines • Show Last 20 Lines | |||||