isChangePlanned(); } public function applyInternalEffects($object, $value) { $status_planned = DifferentialRevisionStatus::CHANGES_PLANNED; $object->setModernRevisionStatus($status_planned); } protected function validateAction($object, PhabricatorUser $viewer) { if ($object->isDraft()) { // See PHI346. Until the "Draft" state fully unprototypes, allow drafts // to be moved to "changes planned" via the API. This preserves the // behavior of "arc diff --plan-changes". We still prevent this // transition from the web UI. // TODO: Remove this once drafts leave prototype. $editor = $this->getEditor(); $type_web = PhabricatorWebContentSource::SOURCECONST; if ($editor->getContentSource()->getSource() == $type_web) { throw new Exception( pht('You can not plan changes to a draft revision.')); } } if ($object->isChangePlanned()) { throw new Exception( pht( 'You can not request review of this revision because this '. 'revision is already under review and the action would have '. 'no effect.')); } if ($object->isClosed()) { throw new Exception( pht( 'You can not plan changes to this this revision because it has '. 'already been closed.')); } if (!$this->isViewerRevisionAuthor($object, $viewer)) { throw new Exception( pht( 'You can not plan changes to this revision because you do not '. 'own it. Only the author of a revision can plan changes to it.')); } } public function getTitle() { if ($this->isDraftDemotion()) { return pht( '%s returned this revision to the author for changes because remote '. 'builds failed.', $this->renderAuthor()); } else { return pht( '%s planned changes to this revision.', $this->renderAuthor()); } } public function getTitleForFeed() { return pht( '%s planned changes to %s.', $this->renderAuthor(), $this->renderObject()); } private function isDraftDemotion() { return (bool)$this->getMetadataValue('draft.demote'); } public function getTransactionTypeForConduit($xaction) { return 'plan-changes'; } public function getFieldValuesForConduit($object, $data) { return array(); } }