Differential D18626 Diff 44738 src/applications/differential/xaction/DifferentialRevisionPlanChangesTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionPlanChangesTransaction.php
| <?php | <?php | ||||
| final class DifferentialRevisionPlanChangesTransaction | final class DifferentialRevisionPlanChangesTransaction | ||||
| extends DifferentialRevisionActionTransaction { | extends DifferentialRevisionActionTransaction { | ||||
| const TRANSACTIONTYPE = 'differential.revision.plan'; | const TRANSACTIONTYPE = 'differential.revision.plan'; | ||||
| const ACTIONKEY = 'plan-changes'; | const ACTIONKEY = 'plan-changes'; | ||||
| protected function getRevisionActionLabel() { | protected function getRevisionActionLabel() { | ||||
| return pht('Plan Changes'); | return pht('Plan Changes'); | ||||
| } | } | ||||
| protected function getRevisionActionDescription() { | protected function getRevisionActionDescription( | ||||
| DifferentialRevision $revision) { | |||||
| return pht( | return pht( | ||||
| 'This revision will be removed from review queues until it is revised.'); | 'This revision will be removed from review queues until it is revised.'); | ||||
| } | } | ||||
| public function getIcon() { | public function getIcon() { | ||||
| return 'fa-headphones'; | return 'fa-headphones'; | ||||
| } | } | ||||
| Show All 28 Lines | final class DifferentialRevisionPlanChangesTransaction | ||||
| } | } | ||||
| public function applyInternalEffects($object, $value) { | public function applyInternalEffects($object, $value) { | ||||
| $status_planned = DifferentialRevisionStatus::CHANGES_PLANNED; | $status_planned = DifferentialRevisionStatus::CHANGES_PLANNED; | ||||
| $object->setModernRevisionStatus($status_planned); | $object->setModernRevisionStatus($status_planned); | ||||
| } | } | ||||
| protected function validateAction($object, PhabricatorUser $viewer) { | protected function validateAction($object, PhabricatorUser $viewer) { | ||||
| if ($object->isDraft()) { | |||||
| throw new Exception( | |||||
| pht('You can not plan changes to a draft revision.')); | |||||
| } | |||||
| if ($object->isChangePlanned()) { | if ($object->isChangePlanned()) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'You can not request review of this revision because this '. | 'You can not request review of this revision because this '. | ||||
| 'revision is already under review and the action would have '. | 'revision is already under review and the action would have '. | ||||
| 'no effect.')); | 'no effect.')); | ||||
| } | } | ||||
| Show All 29 Lines | |||||