@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 PhabricatorProjectStatusTransaction
4 extends PhabricatorProjectTransactionType {
5
6 const TRANSACTIONTYPE = 'project: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 public function getTitle() {
17 $old = $this->getOldValue();
18
19 if ($old == 0) {
20 return pht(
21 '%s archived this project.',
22 $this->renderAuthor());
23 } else {
24 return pht(
25 '%s activated this project.',
26 $this->renderAuthor());
27 }
28 }
29
30 public function getTitleForFeed() {
31 $old = $this->getOldValue();
32
33 if ($old == 0) {
34 return pht(
35 '%s archived %s.',
36 $this->renderAuthor(),
37 $this->renderObject());
38 } else {
39 return pht(
40 '%s activated %s.',
41 $this->renderAuthor(),
42 $this->renderObject());
43 }
44 }
45
46 public function getColor() {
47 $old = $this->getOldValue();
48
49 if ($old == 0) {
50 return 'red';
51 } else {
52 return 'green';
53 }
54 }
55
56 public function getIcon() {
57 $old = $this->getOldValue();
58
59 if ($old == 0) {
60 return 'fa-ban';
61 } else {
62 return 'fa-check';
63 }
64 }
65
66}