Path: blob/master/src/applications/owners/xaction/PhabricatorOwnersPackageAuthorityTransaction.php
12256 views
<?php12final class PhabricatorOwnersPackageAuthorityTransaction3extends PhabricatorOwnersPackageTransactionType {45const TRANSACTIONTYPE = 'owners.authority';67public function generateOldValue($object) {8return $object->getAuthorityMode();9}1011public function validateTransactions($object, array $xactions) {12$errors = array();1314$map = PhabricatorOwnersPackage::getAuthorityOptionsMap();15foreach ($xactions as $xaction) {16$new = $xaction->getNewValue();1718if (empty($map[$new])) {19$valid = array_keys($map);2021$errors[] = $this->newInvalidError(22pht(23'Authority setting "%s" is not valid. '.24'Valid settings are: %s.',25$new,26implode(', ', $valid)),27$xaction);28}29}3031return $errors;32}3334public function applyInternalEffects($object, $value) {35$object->setAuthorityMode($value);36}3738public function getTitle() {39$map = PhabricatorOwnersPackage::getAuthorityOptionsMap();40$map = ipull($map, 'short');4142$old = $this->getOldValue();43$new = $this->getNewValue();4445$old = idx($map, $old, $old);46$new = idx($map, $new, $new);4748return pht(49'%s adjusted package authority rules from %s to %s.',50$this->renderAuthor(),51$this->renderValue($old),52$this->renderValue($new));53}5455}565758