@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 FundInitiativeRisksTransaction
4 extends FundInitiativeTransactionType {
5
6 const TRANSACTIONTYPE = 'fund:risks';
7
8 public function generateOldValue($object) {
9 return $object->getRisks();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $object->setRisks($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 risks/challenges.',
32 $this->renderAuthor());
33 } else {
34 return pht(
35 '%s updated the initiative risks/challenges.',
36 $this->renderAuthor());
37 }
38
39 }
40
41 public function getTitleForFeed() {
42 return pht(
43 '%s updated the initiative risks/challenges for %s.',
44 $this->renderAuthor(),
45 $this->renderObject());
46 }
47
48 public function hasChangeDetailView() {
49 return true;
50 }
51
52 public function getMailDiffSectionHeader() {
53 return pht('CHANGES TO INITIATIVE RISKS/CHALLENGES');
54 }
55
56 public function newChangeDetailView() {
57 $viewer = $this->getViewer();
58
59 return id(new PhabricatorApplicationTransactionTextDiffDetailView())
60 ->setViewer($viewer)
61 ->setOldText($this->getOldValue())
62 ->setNewText($this->getNewValue());
63 }
64
65 public function newRemarkupChanges() {
66 $changes = array();
67
68 $changes[] = $this->newRemarkupChange()
69 ->setOldValue($this->getOldValue())
70 ->setNewValue($this->getNewValue());
71
72 return $changes;
73 }
74
75 public function getIcon() {
76 return 'fa-ambulance';
77 }
78
79
80}