@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 PassphraseCredentialDescriptionTransaction
4 extends PassphraseCredentialTransactionType {
5
6 const TRANSACTIONTYPE = 'passphrase: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 if (!strlen($old)) {
19 return true;
20 }
21 return false;
22 }
23
24 public function getTitle() {
25 return pht(
26 '%s updated the description for this credential.',
27 $this->renderAuthor());
28 }
29
30 public function getTitleForFeed() {
31 return pht(
32 '%s updated the description for credential %s.',
33 $this->renderAuthor(),
34 $this->renderObject());
35 }
36
37 public function hasChangeDetailView() {
38 return true;
39 }
40
41 public function getMailDiffSectionHeader() {
42 return pht('CHANGES TO CREDENTIAL DESCRIPTION');
43 }
44
45 public function newChangeDetailView() {
46 $viewer = $this->getViewer();
47
48 return id(new PhabricatorApplicationTransactionTextDiffDetailView())
49 ->setViewer($viewer)
50 ->setOldText($this->getOldValue())
51 ->setNewText($this->getNewValue());
52 }
53
54 public function newRemarkupChanges() {
55 $changes = array();
56
57 $changes[] = $this->newRemarkupChange()
58 ->setOldValue($this->getOldValue())
59 ->setNewValue($this->getNewValue());
60
61 return $changes;
62 }
63
64}