Differential D18341 Diff 44160 src/applications/differential/xaction/DifferentialRevisionReopenTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionReopenTransaction.php
| Show All 33 Lines | public function generateOldValue($object) { | ||||
| return !$object->isClosed(); | return !$object->isClosed(); | ||||
| } | } | ||||
| public function applyInternalEffects($object, $value) { | public function applyInternalEffects($object, $value) { | ||||
| $object->setStatus(ArcanistDifferentialRevisionStatus::NEEDS_REVIEW); | $object->setStatus(ArcanistDifferentialRevisionStatus::NEEDS_REVIEW); | ||||
| } | } | ||||
| protected function validateAction($object, PhabricatorUser $viewer) { | protected function validateAction($object, PhabricatorUser $viewer) { | ||||
| // Note that we're testing for "Closed", exactly, not just any closed | if ($object->isPublished()) { | ||||
| // status. | |||||
| $status_closed = ArcanistDifferentialRevisionStatus::CLOSED; | |||||
| if ($object->getStatus() != $status_closed) { | |||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'You can not reopen this revision because it is not closed. '. | 'You can not reopen this revision because it is not closed. '. | ||||
| 'Only closed revisions can be reopened.')); | 'Only closed revisions can be reopened.')); | ||||
| } | } | ||||
| $config_key = 'differential.allow-reopen'; | $config_key = 'differential.allow-reopen'; | ||||
| if (!PhabricatorEnv::getEnvConfig($config_key)) { | if (!PhabricatorEnv::getEnvConfig($config_key)) { | ||||
| Show All 23 Lines | |||||