Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/drydock/xaction/DrydockBlueprintDisableTransaction.php
12256 views
1
<?php
2
3
final class DrydockBlueprintDisableTransaction
4
extends DrydockBlueprintTransactionType {
5
6
const TRANSACTIONTYPE = 'drydock:blueprint:disabled';
7
8
public function generateOldValue($object) {
9
return (bool)$object->getIsDisabled();
10
}
11
12
public function generateNewValue($object, $value) {
13
return (bool)$value;
14
}
15
16
public function applyInternalEffects($object, $value) {
17
$object->setIsDisabled((int)$value);
18
}
19
20
public function getTitle() {
21
$new = $this->getNewValue();
22
if ($new) {
23
return pht(
24
'%s disabled this blueprint.',
25
$this->renderAuthor());
26
} else {
27
return pht(
28
'%s enabled this blueprint.',
29
$this->renderAuthor());
30
}
31
}
32
33
public function getTitleForFeed() {
34
$new = $this->getNewValue();
35
if ($new) {
36
return pht(
37
'%s disabled %s.',
38
$this->renderAuthor(),
39
$this->renderObject());
40
} else {
41
return pht(
42
'%s enabled %s.',
43
$this->renderAuthor(),
44
$this->renderObject());
45
}
46
}
47
48
}
49
50