Differential D9306 Diff 22267 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
| Show First 20 Lines • Show All 783 Lines • ▼ Show 20 Lines | private function validateDifferentialAction( | ||||
| $type, | $type, | ||||
| DifferentialTransaction $xaction, | DifferentialTransaction $xaction, | ||||
| $action) { | $action) { | ||||
| $author_phid = $revision->getAuthorPHID(); | $author_phid = $revision->getAuthorPHID(); | ||||
| $actor_phid = $this->getActor()->getPHID(); | $actor_phid = $this->getActor()->getPHID(); | ||||
| $actor_is_author = ($author_phid == $actor_phid); | $actor_is_author = ($author_phid == $actor_phid); | ||||
| $config_abandon_key = 'differential.always-allow-abandon'; | |||||
| $always_allow_abandon = PhabricatorEnv::getEnvConfig($config_abandon_key); | |||||
| $config_close_key = 'differential.always-allow-close'; | $config_close_key = 'differential.always-allow-close'; | ||||
| $always_allow_close = PhabricatorEnv::getEnvConfig($config_close_key); | $always_allow_close = PhabricatorEnv::getEnvConfig($config_close_key); | ||||
| $config_reopen_key = 'differential.allow-reopen'; | $config_reopen_key = 'differential.allow-reopen'; | ||||
| $allow_reopen = PhabricatorEnv::getEnvConfig($config_reopen_key); | $allow_reopen = PhabricatorEnv::getEnvConfig($config_reopen_key); | ||||
| $config_self_accept_key = 'differential.allow-self-accept'; | $config_self_accept_key = 'differential.allow-self-accept'; | ||||
| $allow_self_accept = PhabricatorEnv::getEnvConfig($config_self_accept_key); | $allow_self_accept = PhabricatorEnv::getEnvConfig($config_self_accept_key); | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | switch ($action) { | ||||
| if ($revision_status == $status_closed) { | if ($revision_status == $status_closed) { | ||||
| return pht( | return pht( | ||||
| "You can not commandeer this revision because it has already been ". | "You can not commandeer this revision because it has already been ". | ||||
| "closed."); | "closed."); | ||||
| } | } | ||||
| break; | break; | ||||
| case DifferentialAction::ACTION_ABANDON: | case DifferentialAction::ACTION_ABANDON: | ||||
| if (!$actor_is_author) { | if (!$actor_is_author && !$always_allow_abandon) { | ||||
| return pht( | return pht( | ||||
| "You can not abandon this revision because you do not own it. ". | "You can not abandon this revision because you do not own it. ". | ||||
| "You can only abandon revisions you own."); | "You can only abandon revisions you own."); | ||||
| } | } | ||||
| if ($revision_status == $status_closed) { | if ($revision_status == $status_closed) { | ||||
| return pht( | return pht( | ||||
| "You can not abandon this revision because it has already been ". | "You can not abandon this revision because it has already been ". | ||||
| ▲ Show 20 Lines • Show All 834 Lines • Show Last 20 Lines | |||||