Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/customfield/DifferentialRevertPlanField.php
12256 views
1
<?php
2
3
final class DifferentialRevertPlanField
4
extends DifferentialStoredCustomField {
5
6
public function getFieldKey() {
7
return 'phabricator:revert-plan';
8
}
9
10
public function getFieldKeyForConduit() {
11
return 'revertPlan';
12
}
13
14
public function getFieldName() {
15
return pht('Revert Plan');
16
}
17
18
public function getFieldDescription() {
19
return pht('Instructions for reverting/undoing this change.');
20
}
21
22
public function shouldDisableByDefault() {
23
return true;
24
}
25
26
public function shouldAppearInPropertyView() {
27
return true;
28
}
29
30
public function renderPropertyViewLabel() {
31
return $this->getFieldName();
32
}
33
34
public function getStyleForPropertyView() {
35
return 'block';
36
}
37
38
public function getIconForPropertyView() {
39
return PHUIPropertyListView::ICON_TESTPLAN;
40
}
41
42
public function renderPropertyViewValue(array $handles) {
43
if (!strlen($this->getValue())) {
44
return null;
45
}
46
47
return new PHUIRemarkupView($this->getViewer(), $this->getValue());
48
}
49
50
public function shouldAppearInGlobalSearch() {
51
return true;
52
}
53
54
public function updateAbstractDocument(
55
PhabricatorSearchAbstractDocument $document) {
56
if (strlen($this->getValue())) {
57
$document->addField('rvrt', $this->getValue());
58
}
59
}
60
61
public function shouldAppearInEditView() {
62
return true;
63
}
64
65
public function shouldAppearInApplicationTransactions() {
66
return true;
67
}
68
69
public function getOldValueForApplicationTransactions() {
70
return $this->getValue();
71
}
72
73
public function getNewValueForApplicationTransactions() {
74
return $this->getValue();
75
}
76
77
public function readValueFromRequest(AphrontRequest $request) {
78
$this->setValue($request->getStr($this->getFieldKey()));
79
}
80
81
public function renderEditControl(array $handles) {
82
return id(new PhabricatorRemarkupControl())
83
->setUser($this->getViewer())
84
->setName($this->getFieldKey())
85
->setValue($this->getValue())
86
->setLabel($this->getFieldName());
87
}
88
89
public function getApplicationTransactionTitle(
90
PhabricatorApplicationTransaction $xaction) {
91
$author_phid = $xaction->getAuthorPHID();
92
$old = $xaction->getOldValue();
93
$new = $xaction->getNewValue();
94
95
return pht(
96
'%s updated the revert plan for this revision.',
97
$xaction->renderHandleLink($author_phid));
98
}
99
100
public function getApplicationTransactionTitleForFeed(
101
PhabricatorApplicationTransaction $xaction) {
102
103
$object_phid = $xaction->getObjectPHID();
104
$author_phid = $xaction->getAuthorPHID();
105
$old = $xaction->getOldValue();
106
$new = $xaction->getNewValue();
107
108
return pht(
109
'%s updated the revert plan for %s.',
110
$xaction->renderHandleLink($author_phid),
111
$xaction->renderHandleLink($object_phid));
112
}
113
114
public function getApplicationTransactionHasChangeDetails(
115
PhabricatorApplicationTransaction $xaction) {
116
return true;
117
}
118
119
public function getApplicationTransactionChangeDetails(
120
PhabricatorApplicationTransaction $xaction,
121
PhabricatorUser $viewer) {
122
return $xaction->renderTextCorpusChangeDetails(
123
$viewer,
124
$xaction->getOldValue(),
125
$xaction->getNewValue());
126
}
127
128
public function getApplicationTransactionRemarkupBlocks(
129
PhabricatorApplicationTransaction $xaction) {
130
return array($xaction->getNewValue());
131
}
132
133
public function shouldAppearInConduitDictionary() {
134
return true;
135
}
136
137
public function shouldAppearInConduitTransactions() {
138
return true;
139
}
140
141
protected function newConduitEditParameterType() {
142
return new ConduitStringParameterType();
143
}
144
145
}
146
147