Differential D21403 Diff 50946 src/applications/differential/xaction/DifferentialRevisionActionTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionActionTransaction.php
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | abstract class DifferentialRevisionActionTransaction | ||||
| } | } | ||||
| protected function getRevisionActionSubmitButtonText( | protected function getRevisionActionSubmitButtonText( | ||||
| DifferentialRevision $revision, | DifferentialRevision $revision, | ||||
| PhabricatorUser $viewer) { | PhabricatorUser $viewer) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| protected function getRevisionActionMetadata( | |||||
| DifferentialRevision $revision, | |||||
| PhabricatorUser $viewer) { | |||||
| return array(); | |||||
| } | |||||
| public static function loadAllActions() { | public static function loadAllActions() { | ||||
| return id(new PhutilClassMapQuery()) | return id(new PhutilClassMapQuery()) | ||||
| ->setAncestorClass(__CLASS__) | ->setAncestorClass(__CLASS__) | ||||
| ->setUniqueMethod('getRevisionActionKey') | ->setUniqueMethod('getRevisionActionKey') | ||||
| ->execute(); | ->execute(); | ||||
| } | } | ||||
| protected function isViewerRevisionAuthor( | protected function isViewerRevisionAuthor( | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if ($this->isActionAvailable($revision, $viewer)) { | ||||
| $can_multi = (count($options) > 1); | $can_multi = (count($options) > 1); | ||||
| $can_force = (count($value) < count($options)); | $can_force = (count($value) < count($options)); | ||||
| $not_self = (head_key($options) != $viewer->getPHID()); | $not_self = (head_key($options) != $viewer->getPHID()); | ||||
| if ($can_multi || $can_force || $not_self) { | if ($can_multi || $can_force || $not_self) { | ||||
| $field->setOptions($options); | $field->setOptions($options); | ||||
| $field->setValue($value); | $field->setValue($value); | ||||
| } | } | ||||
| $metadata = $this->getRevisionActionMetadata($revision, $viewer); | |||||
| foreach ($metadata as $metadata_key => $metadata_value) { | |||||
| $field->setMetadataValue($metadata_key, $metadata_value); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| return $field; | return $field; | ||||
| } | } | ||||
| public function validateTransactions($object, array $xactions) { | public function validateTransactions($object, array $xactions) { | ||||
| $errors = array(); | $errors = array(); | ||||
| ▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines | |||||