@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 PhabricatorPasteTitleTransaction
4 extends PhabricatorPasteTransactionType {
5
6 const TRANSACTIONTYPE = 'paste.title';
7
8 public function generateOldValue($object) {
9 return $object->getTitle();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $object->setTitle($value);
14 }
15
16 public function getTitle() {
17 $old = $this->getOldValue();
18 $new = $this->getNewValue();
19
20 if (strlen($old) && strlen($new)) {
21 return pht(
22 '%s changed the title of this paste from %s to %s.',
23 $this->renderAuthor(),
24 $this->renderOldValue(),
25 $this->renderNewValue());
26 } else if (strlen($new)) {
27 return pht(
28 '%s changed the title of this paste from untitled to %s.',
29 $this->renderAuthor(),
30 $this->renderNewValue());
31 } else {
32 return pht(
33 '%s changed the title of this paste from %s to untitled.',
34 $this->renderAuthor(),
35 $this->renderOldValue());
36 }
37 }
38
39 public function getTitleForFeed() {
40 $old = $this->getOldValue();
41 $new = $this->getNewValue();
42
43 if (strlen($old) && strlen($new)) {
44 return pht(
45 '%s updated the title for %s from %s to %s.',
46 $this->renderAuthor(),
47 $this->renderObject(),
48 $this->renderOldValue(),
49 $this->renderNewValue());
50 } else if (strlen($new)) {
51 return pht(
52 '%s updated the title for %s from untitled to %s.',
53 $this->renderAuthor(),
54 $this->renderObject(),
55 $this->renderNewValue());
56 } else {
57 return pht(
58 '%s updated the title for %s from %s to untitled.',
59 $this->renderAuthor(),
60 $this->renderObject(),
61 $this->renderOldValue());
62 }
63 }
64
65}