Differential D18626 Diff 44738 src/applications/differential/xaction/DifferentialRevisionResignTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionResignTransaction.php
| <?php | <?php | ||||
| final class DifferentialRevisionResignTransaction | final class DifferentialRevisionResignTransaction | ||||
| extends DifferentialRevisionReviewTransaction { | extends DifferentialRevisionReviewTransaction { | ||||
| const TRANSACTIONTYPE = 'differential.revision.resign'; | const TRANSACTIONTYPE = 'differential.revision.resign'; | ||||
| const ACTIONKEY = 'resign'; | const ACTIONKEY = 'resign'; | ||||
| protected function getRevisionActionLabel() { | protected function getRevisionActionLabel() { | ||||
| return pht('Resign as Reviewer'); | return pht('Resign as Reviewer'); | ||||
| } | } | ||||
| protected function getRevisionActionDescription() { | protected function getRevisionActionDescription( | ||||
| DifferentialRevision $revision) { | |||||
| return pht('You will resign as a reviewer for this change.'); | return pht('You will resign as a reviewer for this change.'); | ||||
| } | } | ||||
| public function getIcon() { | public function getIcon() { | ||||
| return 'fa-flag'; | return 'fa-flag'; | ||||
| } | } | ||||
| public function getColor() { | public function getColor() { | ||||
| Show All 36 Lines | final class DifferentialRevisionResignTransaction | ||||
| protected function validateAction($object, PhabricatorUser $viewer) { | protected function validateAction($object, PhabricatorUser $viewer) { | ||||
| if ($object->isClosed()) { | if ($object->isClosed()) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'You can not resign from this revision because it has already '. | 'You can not resign from this revision because it has already '. | ||||
| 'been closed. You can only resign from open revisions.')); | 'been closed. You can only resign from open revisions.')); | ||||
| } | } | ||||
| if ($object->isDraft()) { | |||||
| throw new Exception( | |||||
| pht('You can not resign from a draft revision.')); | |||||
| } | |||||
| $resigned = DifferentialReviewerStatus::STATUS_RESIGNED; | $resigned = DifferentialReviewerStatus::STATUS_RESIGNED; | ||||
| if ($this->getViewerReviewerStatus($object, $viewer) == $resigned) { | if ($this->getViewerReviewerStatus($object, $viewer) == $resigned) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'You can not resign from this revision because you have already '. | 'You can not resign from this revision because you have already '. | ||||
| 'resigned.')); | 'resigned.')); | ||||
| } | } | ||||
| Show All 22 Lines | |||||