Differential D19829 Diff 47354 src/applications/repository/xaction/PhabricatorRepositoryNameTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/xaction/PhabricatorRepositoryNameTransaction.php
- This file was added.
<?php | |||||
final class PhabricatorRepositoryNameTransaction | |||||
extends PhabricatorRepositoryTransactionType { | |||||
const TRANSACTIONTYPE = 'repo:name'; | |||||
public function generateOldValue($object) { | |||||
return $object->getName(); | |||||
} | |||||
public function applyInternalEffects($object, $value) { | |||||
$object->setName($value); | |||||
} | |||||
public function getTitle() { | |||||
return pht( | |||||
'%s renamed this repository from %s to %s.', | |||||
$this->renderAuthor(), | |||||
$this->renderOldValue(), | |||||
$this->renderNewValue()); | |||||
} | |||||
public function validateTransactions($object, array $xactions) { | |||||
$errors = array(); | |||||
if ($this->isEmptyTextTransaction($object->getName(), $xactions)) { | |||||
$errors[] = $this->newRequiredError( | |||||
pht('Repositories must have a name.')); | |||||
} | |||||
return $errors; | |||||
} | |||||
} |