mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 12:42:43 +01:00
6b9f4a918b
Summary: Ref T13319. Ref PHI1302. Migrate `PhabricatorEditEngineConfigurationTransaction` to modular transactions and add some additional transaction rendering to make these edits less opaque. Test Plan: Hit all the form edit controllers, viewed resulting transaction timeline. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T13319 Differential Revision: https://secure.phabricator.com/D20595
51 lines
1,013 B
PHP
51 lines
1,013 B
PHP
<?php
|
|
|
|
final class PhabricatorEditEngineDisableTransaction
|
|
extends PhabricatorEditEngineTransactionType {
|
|
|
|
const TRANSACTIONTYPE = 'editengine.config.disable';
|
|
|
|
public function generateOldValue($object) {
|
|
return (int)$object->getIsDisabled();
|
|
}
|
|
|
|
public function generateNewValue($object, $value) {
|
|
return (int)$value;
|
|
}
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
$object->setIsDisabled($value);
|
|
}
|
|
|
|
public function getTitle() {
|
|
$new = $this->getNewValue();
|
|
if ($new) {
|
|
return pht(
|
|
'%s disabled this form.',
|
|
$this->renderAuthor());
|
|
} else {
|
|
return pht(
|
|
'%s enabled this form.',
|
|
$this->renderAuthor());
|
|
}
|
|
}
|
|
|
|
public function getColor() {
|
|
$new = $this->getNewValue();
|
|
if ($new) {
|
|
return 'indigo';
|
|
} else {
|
|
return 'green';
|
|
}
|
|
}
|
|
|
|
public function getIcon() {
|
|
$new = $this->getNewValue();
|
|
if ($new) {
|
|
return 'fa-ban';
|
|
} else {
|
|
return 'fa-check';
|
|
}
|
|
}
|
|
|
|
}
|