Path: blob/master/src/applications/differential/xaction/DifferentialRevisionResignTransaction.php
12256 views
<?php12final class DifferentialRevisionResignTransaction3extends DifferentialRevisionReviewTransaction {45const TRANSACTIONTYPE = 'differential.revision.resign';6const ACTIONKEY = 'resign';78protected function getRevisionActionLabel(9DifferentialRevision $revision,10PhabricatorUser $viewer) {11return pht('Resign as Reviewer');12}1314protected function getRevisionActionDescription(15DifferentialRevision $revision,16PhabricatorUser $viewer) {17return pht('You will resign as a reviewer for this change.');18}1920public function getIcon() {21return 'fa-flag';22}2324public function getColor() {25return 'orange';26}2728protected function getRevisionActionOrder() {29return 700;30}3132public function getCommandKeyword() {33return 'resign';34}3536public function getActionName() {37return pht('Resigned');38}3940public function getCommandAliases() {41return array();42}4344public function getCommandSummary() {45return pht('Resign from a revision.');46}4748public function generateOldValue($object) {49$actor = $this->getActor();50$resigned = DifferentialReviewerStatus::STATUS_RESIGNED;5152return ($this->getViewerReviewerStatus($object, $actor) == $resigned);53}5455public function applyExternalEffects($object, $value) {56$status = DifferentialReviewerStatus::STATUS_RESIGNED;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 resign from this revision because it has already '.66'been closed. You can only resign from open revisions.'));67}6869$resigned = DifferentialReviewerStatus::STATUS_RESIGNED;70if ($this->getViewerReviewerStatus($object, $viewer) == $resigned) {71throw new Exception(72pht(73'You can not resign from this revision because you have already '.74'resigned.'));75}7677if (!$this->isViewerAnyAuthority($object, $viewer)) {78throw new Exception(79pht(80'You can not resign from this revision because you are not a '.81'reviewer, and do not have authority over any reviewer.'));82}83}8485public function getTitle() {86return pht(87'%s resigned from this revision.',88$this->renderAuthor());89}9091public function getTitleForFeed() {92return pht(93'%s resigned from %s.',94$this->renderAuthor(),95$this->renderObject());96}9798public function getTransactionTypeForConduit($xaction) {99return 'resign';100}101102public function getFieldValuesForConduit($object, $data) {103return array();104}105106}107108109