Differential D8657 Diff 20543 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
| <?php | <?php | ||||
| final class DifferentialTransactionEditor | final class DifferentialTransactionEditor | ||||
| extends PhabricatorApplicationTransactionEditor { | extends PhabricatorApplicationTransactionEditor { | ||||
| private $heraldEmailPHIDs; | private $heraldEmailPHIDs; | ||||
| private $changedPriorToCommitURI; | private $changedPriorToCommitURI; | ||||
| private $isCloseByCommit; | private $isCloseByCommit; | ||||
| public function getDiffUpdateTransaction(array $xactions) { | |||||
| $type_update = DifferentialTransaction::TYPE_UPDATE; | |||||
| foreach ($xactions as $xaction) { | |||||
| if ($xaction->getTransactionType() == $type_update) { | |||||
| return $xaction; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public function setIsCloseByCommit($is_close_by_commit) { | public function setIsCloseByCommit($is_close_by_commit) { | ||||
| $this->isCloseByCommit = $is_close_by_commit; | $this->isCloseByCommit = $is_close_by_commit; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getIsCloseByCommit() { | public function getIsCloseByCommit() { | ||||
| return $this->isCloseByCommit; | return $this->isCloseByCommit; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | switch ($xaction->getTransactionType()) { | ||||
| $object->setStatus($status_review); | $object->setStatus($status_review); | ||||
| } | } | ||||
| $diff = $this->requireDiff($xaction->getNewValue()); | $diff = $this->requireDiff($xaction->getNewValue()); | ||||
| $object->setLineCount($diff->getLineCount()); | $object->setLineCount($diff->getLineCount()); | ||||
| $object->setRepositoryPHID($diff->getRepositoryPHID()); | $object->setRepositoryPHID($diff->getRepositoryPHID()); | ||||
| $object->setArcanistProjectPHID($diff->getArcanistProjectPHID()); | $object->setArcanistProjectPHID($diff->getArcanistProjectPHID()); | ||||
| $object->attachActiveDiff($diff); | |||||
| // TODO: Update the `diffPHID` once we add that. | // TODO: Update the `diffPHID` once we add that. | ||||
| return; | return; | ||||
| case DifferentialTransaction::TYPE_ACTION: | case DifferentialTransaction::TYPE_ACTION: | ||||
| switch ($xaction->getNewValue()) { | switch ($xaction->getNewValue()) { | ||||
| case DifferentialAction::ACTION_RESIGN: | case DifferentialAction::ACTION_RESIGN: | ||||
| case DifferentialAction::ACTION_ACCEPT: | case DifferentialAction::ACTION_ACCEPT: | ||||
| case DifferentialAction::ACTION_REJECT: | case DifferentialAction::ACTION_REJECT: | ||||
| ▲ Show 20 Lines • Show All 891 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| protected function buildMailBody( | protected function buildMailBody( | ||||
| PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
| array $xactions) { | array $xactions) { | ||||
| $body = parent::buildMailBody($object, $xactions); | $body = parent::buildMailBody($object, $xactions); | ||||
| if ($this->getIsNewObject()) { | |||||
| $summary = $object->getSummary(); | |||||
| if (strlen(trim($summary))) { | |||||
| $body->addTextSection( | |||||
| pht('REVISION SUMMARY'), | |||||
| $summary); | |||||
| } | |||||
| $test_plan = $object->getTestPlan(); | |||||
| if (strlen(trim($test_plan))) { | |||||
| $body->addTextSection( | |||||
| pht('TEST PLAN'), | |||||
| $test_plan); | |||||
| } | |||||
| } | |||||
| $type_inline = DifferentialTransaction::TYPE_INLINE; | $type_inline = DifferentialTransaction::TYPE_INLINE; | ||||
| $inlines = array(); | $inlines = array(); | ||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| if ($xaction->getTransactionType() == $type_inline) { | if ($xaction->getTransactionType() == $type_inline) { | ||||
| $inlines[] = $xaction; | $inlines[] = $xaction; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 593 Lines • Show Last 20 Lines | |||||