Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/paste/xaction/PhabricatorPasteStatusTransaction.php
12241 views
1
<?php
2
3
final class PhabricatorPasteStatusTransaction
4
extends PhabricatorPasteTransactionType {
5
6
const TRANSACTIONTYPE = 'paste.status';
7
8
public function generateOldValue($object) {
9
return $object->getStatus();
10
}
11
12
public function applyInternalEffects($object, $value) {
13
$object->setStatus($value);
14
}
15
16
private function isActivate() {
17
return ($this->getNewValue() == PhabricatorPaste::STATUS_ACTIVE);
18
}
19
20
public function getIcon() {
21
if ($this->isActivate()) {
22
return 'fa-check';
23
} else {
24
return 'fa-ban';
25
}
26
}
27
28
public function getColor() {
29
if ($this->isActivate()) {
30
return 'green';
31
} else {
32
return 'indigo';
33
}
34
}
35
36
public function getTitle() {
37
if ($this->isActivate()) {
38
return pht(
39
'%s activated this paste.',
40
$this->renderAuthor());
41
} else {
42
return pht(
43
'%s archived this paste.',
44
$this->renderAuthor());
45
}
46
}
47
48
public function getTitleForFeed() {
49
if ($this->isActivate()) {
50
return pht(
51
'%s activated %s.',
52
$this->renderAuthor(),
53
$this->renderObject());
54
} else {
55
return pht(
56
'%s archived %s.',
57
$this->renderAuthor(),
58
$this->renderObject());
59
}
60
}
61
62
}
63
64