2017-05-20 15:34:07 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorProjectLockTransaction
|
|
|
|
extends PhabricatorProjectTransactionType {
|
|
|
|
|
|
|
|
const TRANSACTIONTYPE = 'project:locked';
|
|
|
|
|
|
|
|
public function generateOldValue($object) {
|
|
|
|
return (int)$object->getIsMembershipLocked();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
|
|
$object->setIsMembershipLocked($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
if ($new) {
|
|
|
|
return pht(
|
|
|
|
"%s locked this project's membership.",
|
|
|
|
$this->renderAuthor());
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
"%s unlocked this project's membership.",
|
|
|
|
$this->renderAuthor());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitleForFeed() {
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
if ($new) {
|
|
|
|
return pht(
|
|
|
|
'%s locked %s membership.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderObject());
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s unlocked %s membership.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderObject());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIcon() {
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
if ($new) {
|
|
|
|
return 'fa-lock';
|
|
|
|
} else {
|
|
|
|
return 'fa-unlock';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-14 14:46:59 -07:00
|
|
|
public function validateTransactions($object, array $xactions) {
|
|
|
|
if ($xactions) {
|
|
|
|
$this->requireApplicationCapability(
|
|
|
|
ProjectCanLockProjectsCapability::CAPABILITY);
|
|
|
|
}
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2017-05-20 15:34:07 -07:00
|
|
|
}
|