Differential D19398 Diff 46405 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()) { | if ($object->isDraft() || !$object->getShouldBroadcast()) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht('You can not accept a draft revision.')); | 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( | ||||
| ▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines | |||||