Differential D18802 Diff 45116 src/applications/differential/xaction/DifferentialRevisionAcceptTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionAcceptTransaction.php
| Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | final class DifferentialRevisionAcceptTransaction | ||||
| 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 accept this revision because it has already been '. | 'You can not accept this revision because it has already been '. | ||||
| 'closed. Only open revisions can be accepted.')); | 'closed. Only open revisions can be accepted.')); | ||||
| } | } | ||||
| if ($object->isDraft()) { | |||||
| throw new Exception( | |||||
| pht('You can not accept a draft revision.')); | |||||
| } | |||||
| $config_key = 'differential.allow-self-accept'; | $config_key = 'differential.allow-self-accept'; | ||||
| if (!PhabricatorEnv::getEnvConfig($config_key)) { | if (!PhabricatorEnv::getEnvConfig($config_key)) { | ||||
| if ($this->isViewerRevisionAuthor($object, $viewer)) { | if ($this->isViewerRevisionAuthor($object, $viewer)) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'You can not accept this revision because you are the revision '. | 'You can not accept this revision because you are the revision '. | ||||
| 'author. You can only accept revisions you do not own. You can '. | 'author. You can only accept revisions you do not own. You can '. | ||||
| 'change this behavior by adjusting the "%s" setting in Config.', | 'change this behavior by adjusting the "%s" setting in Config.', | ||||
| ▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines | |||||