3 final class PhabricatorRepositoryActivateTransaction
4 extends PhabricatorRepositoryTransactionType
{
6 const TRANSACTIONTYPE
= 'repo:activate';
8 public function generateOldValue($object) {
9 return $object->isTracked();
12 public function applyInternalEffects($object, $value) {
13 // The first time a repository is activated, clear the "new repository"
14 // flag so we stop showing setup hints.
16 $object->setDetail('newly-initialized', false);
19 $object->setDetail('tracking-enabled', $value);
22 public function getTitle() {
23 $new = $this->getNewValue();
25 // TODO: Old versions of this transaction use a boolean value, but
26 // should be migrated.
29 ($new == PhabricatorRepository
::STATUS_INACTIVE
);
31 if (!$is_deactivate) {
33 '%s activated this repository.',
34 $this->renderAuthor());
37 '%s deactivated this repository.',
38 $this->renderAuthor());
42 public function validateTransactions($object, array $xactions) {
45 $status_map = PhabricatorRepository
::getStatusMap();
46 foreach ($xactions as $xaction) {
47 $status = $xaction->getNewValue();
48 if (empty($status_map[$status])) {
49 $errors[] = $this->newInvalidError(
51 'Repository status "%s" is not valid. Valid statuses are: %s.',
53 implode(', ', array_keys($status_map))),