Path: blob/master/src/applications/differential/xaction/DifferentialRevisionRejectTransaction.php
12256 views
<?php12final class DifferentialRevisionRejectTransaction3extends DifferentialRevisionReviewTransaction {45const TRANSACTIONTYPE = 'differential.revision.reject';6const ACTIONKEY = 'reject';78protected function getRevisionActionLabel(9DifferentialRevision $revision,10PhabricatorUser $viewer) {11return pht('Request Changes');12}1314protected function getRevisionActionDescription(15DifferentialRevision $revision,16PhabricatorUser $viewer) {17return pht('This revision will be returned to the author for updates.');18}1920public function getIcon() {21return 'fa-times-circle-o';22}2324public function getColor() {25return 'red';26}2728protected function getRevisionActionOrder() {29return 600;30}3132public function getActionName() {33return pht('Requested Changes');34}3536public function getCommandKeyword() {37return 'request';38}3940public function getCommandAliases() {41return array(42'reject',43);44}4546public function getCommandSummary() {47return pht('Request changes to a revision.');48}4950public function generateOldValue($object) {51$actor = $this->getActor();52return $this->isViewerFullyRejected($object, $actor);53}5455public function applyExternalEffects($object, $value) {56$status = DifferentialReviewerStatus::STATUS_REJECTED;57$actor = $this->getActor();58$this->applyReviewerEffect($object, $actor, $value, $status);59}6061protected function validateAction($object, PhabricatorUser $viewer) {62if ($object->isClosed()) {63throw new Exception(64pht(65'You can not request changes to this revision because it has '.66'already been closed. You can only request changes to open '.67'revisions.'));68}6970if ($this->isViewerRevisionAuthor($object, $viewer)) {71throw new Exception(72pht(73'You can not request changes to this revision because you are the '.74'revision author. You can only request changes to revisions you do '.75'not own.'));76}7778if ($object->isDraft() || !$object->getShouldBroadcast()) {79throw new Exception(80pht('You can not request changes to a draft revision.'));81}8283if ($this->isViewerFullyRejected($object, $viewer)) {84throw new Exception(85pht(86'You can not request changes to this revision because you have '.87'already requested changes.'));88}89}9091public function getTitle() {92return pht(93'%s requested changes to this revision.',94$this->renderAuthor());95}9697public function getTitleForFeed() {98return pht(99'%s requested changes to %s.',100$this->renderAuthor(),101$this->renderObject());102}103104public function getTransactionTypeForConduit($xaction) {105return 'request-changes';106}107108public function getFieldValuesForConduit($object, $data) {109return array();110}111112}113114115