Differential D18416 Diff 44260 src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
| Show All 13 Lines | final class DiffusionCommitRevisionAcceptedHeraldField | ||||
| } | } | ||||
| public function getHeraldFieldValue($object) { | public function getHeraldFieldValue($object) { | ||||
| $revision = $this->getAdapter()->loadDifferentialRevision(); | $revision = $this->getAdapter()->loadDifferentialRevision(); | ||||
| if (!$revision) { | if (!$revision) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| $status = $revision->getStatus(); | if ($revision->isAccepted()) { | ||||
| switch ($status) { | |||||
| case ArcanistDifferentialRevisionStatus::ACCEPTED: | |||||
| return $revision->getPHID(); | |||||
| case ArcanistDifferentialRevisionStatus::CLOSED: | |||||
| if ($revision->hasRevisionProperty( | |||||
| DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) { | |||||
| if ($revision->getProperty( | |||||
| DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) { | |||||
| return $revision->getPHID(); | return $revision->getPHID(); | ||||
| } else { | |||||
| return null; | |||||
| } | |||||
| } else { | |||||
| // continue on to old-style precommitRevisionStatus | |||||
| break; | |||||
| } | |||||
| default: | |||||
| return null; | |||||
| } | } | ||||
| $data = $object->getCommitData(); | $was_accepted = DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED; | ||||
| $status = $data->getCommitDetail('precommitRevisionStatus'); | if ($revision->isPublished()) { | ||||
| if ($revision->getProperty($was_accepted)) { | |||||
| switch ($status) { | |||||
| case ArcanistDifferentialRevisionStatus::ACCEPTED: | |||||
| case ArcanistDifferentialRevisionStatus::CLOSED: | |||||
| return $revision->getPHID(); | return $revision->getPHID(); | ||||
| } | } | ||||
| } | |||||
| return null; | return null; | ||||
| } | } | ||||
| protected function getHeraldFieldStandardType() { | protected function getHeraldFieldStandardType() { | ||||
| return self::STANDARD_PHID_BOOL; | return self::STANDARD_PHID_BOOL; | ||||
| } | } | ||||
| } | } | ||||