@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class FundInitiativeDescriptionTransaction
4 extends FundInitiativeTransactionType {
5
6 const TRANSACTIONTYPE = 'fund:description';
7
8 public function generateOldValue($object) {
9 return $object->getDescription();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $object->setDescription($value);
14 }
15
16 public function shouldHide() {
17 $old = $this->getOldValue();
18 $new = $this->getNewValue();
19 if (!strlen($old) && !strlen($new)) {
20 return true;
21 }
22 return false;
23 }
24
25 public function getTitle() {
26 $old = $this->getOldValue();
27 $new = $this->getNewValue();
28
29 if ($old === null) {
30 return pht(
31 '%s set the initiative description.',
32 $this->renderAuthor());
33 } else {
34 return pht(
35 '%s updated the initiative description.',
36 $this->renderAuthor());
37 }
38 }
39
40 public function getTitleForFeed() {
41 return pht(
42 '%s updated the initiative description for %s.',
43 $this->renderAuthor(),
44 $this->renderObject());
45 }
46
47 public function hasChangeDetailView() {
48 return true;
49 }
50
51 public function getMailDiffSectionHeader() {
52 return pht('CHANGES TO INITIATIVE DESCRIPTION');
53 }
54
55 public function newChangeDetailView() {
56 $viewer = $this->getViewer();
57
58 return id(new PhabricatorApplicationTransactionTextDiffDetailView())
59 ->setViewer($viewer)
60 ->setOldText($this->getOldValue())
61 ->setNewText($this->getNewValue());
62 }
63
64 public function newRemarkupChanges() {
65 $changes = array();
66
67 $changes[] = $this->newRemarkupChange()
68 ->setOldValue($this->getOldValue())
69 ->setNewValue($this->getNewValue());
70
71 return $changes;
72 }
73
74
75}