@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 PholioMockDescriptionTransaction
4 extends PholioMockTransactionType {
5
6 const TRANSACTIONTYPE = '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 getTitle() {
17 return pht(
18 "%s updated the mock's description.",
19 $this->renderAuthor());
20 }
21
22 public function getTitleForFeed() {
23 return pht(
24 '%s updated the description for %s.',
25 $this->renderAuthor(),
26 $this->renderObject());
27 }
28
29 public function shouldHide() {
30 $old = $this->getOldValue();
31 return ($old === null);
32 }
33
34 public function hasChangeDetailView() {
35 return true;
36 }
37
38 public function newChangeDetailView() {
39 $viewer = $this->getViewer();
40
41 return id(new PhabricatorApplicationTransactionTextDiffDetailView())
42 ->setViewer($viewer)
43 ->setOldText($this->getOldValue())
44 ->setNewText($this->getNewValue());
45 }
46
47 public function newRemarkupChanges() {
48 $changes = array();
49
50 $changes[] = $this->newRemarkupChange()
51 ->setOldValue($this->getOldValue())
52 ->setNewValue($this->getNewValue());
53
54 return $changes;
55 }
56
57}