Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php
13463 views
1
<?php
2
3
final class LegalpadDocumentTextTransaction
4
extends LegalpadDocumentTransactionType {
5
6
const TRANSACTIONTYPE = 'text';
7
8
public function generateOldValue($object) {
9
$body = $object->getDocumentBody();
10
return $body->getText();
11
}
12
13
public function applyInternalEffects($object, $value) {
14
$body = $object->getDocumentBody();
15
$body->setText($value);
16
$object->attachDocumentBody($body);
17
}
18
19
public function getTitle() {
20
$old = $this->getOldValue();
21
22
if (!strlen($old)) {
23
return pht(
24
'%s set the document text.',
25
$this->renderAuthor());
26
} else {
27
return pht(
28
'%s updated the document text.',
29
$this->renderAuthor());
30
}
31
}
32
33
public function getTitleForFeed() {
34
return pht(
35
'%s updated the document text for %s.',
36
$this->renderAuthor(),
37
$this->renderObject());
38
}
39
40
public function hasChangeDetailView() {
41
return true;
42
}
43
44
public function getMailDiffSectionHeader() {
45
return pht('CHANGES TO DOCUMENT TEXT');
46
}
47
48
public function newChangeDetailView() {
49
$viewer = $this->getViewer();
50
51
return id(new PhabricatorApplicationTransactionTextDiffDetailView())
52
->setViewer($viewer)
53
->setOldText($this->getOldValue())
54
->setNewText($this->getNewValue());
55
}
56
57
public function newRemarkupChanges() {
58
$changes = array();
59
60
$changes[] = $this->newRemarkupChange()
61
->setOldValue($this->getOldValue())
62
->setNewValue($this->getNewValue());
63
64
return $changes;
65
}
66
67
68
}
69
70