3 final class PhabricatorOwnersPackageAutoreviewTransaction
4 extends PhabricatorOwnersPackageTransactionType
{
6 const TRANSACTIONTYPE
= 'owners.autoreview';
8 public function generateOldValue($object) {
9 return $object->getAutoReview();
12 public function validateTransactions($object, array $xactions) {
15 $map = PhabricatorOwnersPackage
::getAutoreviewOptionsMap();
16 foreach ($xactions as $xaction) {
17 $new = $xaction->getNewValue();
19 if (empty($map[$new])) {
20 $valid = array_keys($map);
22 $errors[] = $this->newInvalidError(
24 'Autoreview setting "%s" is not valid. '.
25 'Valid settings are: %s.',
27 implode(', ', $valid)),
35 public function applyInternalEffects($object, $value) {
36 $object->setAutoReview($value);
39 public function getTitle() {
40 $map = PhabricatorOwnersPackage
::getAutoreviewOptionsMap();
41 $map = ipull($map, 'name');
43 $old = $this->getOldValue();
44 $new = $this->getNewValue();
46 $old = idx($map, $old, $old);
47 $new = idx($map, $new, $new);
50 '%s adjusted autoreview from %s to %s.',
51 $this->renderAuthor(),
52 $this->renderValue($old),
53 $this->renderValue($new));