@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 PhabricatorPasteStatusTransaction
4 extends PhabricatorPasteTransactionType {
5
6 const TRANSACTIONTYPE = 'paste.status';
7
8 public function generateOldValue($object) {
9 return $object->getStatus();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $object->setStatus($value);
14 }
15
16 private function isActivate() {
17 return ($this->getNewValue() == PhabricatorPaste::STATUS_ACTIVE);
18 }
19
20 public function getIcon() {
21 if ($this->isActivate()) {
22 return 'fa-check';
23 } else {
24 return 'fa-ban';
25 }
26 }
27
28 public function getColor() {
29 if ($this->isActivate()) {
30 return 'green';
31 } else {
32 return 'indigo';
33 }
34 }
35
36 public function getTitle() {
37 if ($this->isActivate()) {
38 return pht(
39 '%s activated this paste.',
40 $this->renderAuthor());
41 } else {
42 return pht(
43 '%s archived this paste.',
44 $this->renderAuthor());
45 }
46 }
47
48 public function getTitleForFeed() {
49 if ($this->isActivate()) {
50 return pht(
51 '%s activated %s.',
52 $this->renderAuthor(),
53 $this->renderObject());
54 } else {
55 return pht(
56 '%s archived %s.',
57 $this->renderAuthor(),
58 $this->renderObject());
59 }
60 }
61
62}