@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 PhameBlogStatusTransaction
4 extends PhameBlogTransactionType {
5
6 const TRANSACTIONTYPE = 'phame.blog.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 $new = $this->getNewValue();
18 switch ($new) {
19 case PhameBlog::STATUS_ACTIVE:
20 return pht(
21 '%s published this blog.',
22 $this->renderAuthor());
23 case PhameBlog::STATUS_ARCHIVED:
24 return pht(
25 '%s archived this blog.',
26 $this->renderAuthor());
27 }
28 }
29
30 public function getTitleForFeed() {
31 $new = $this->getNewValue();
32 switch ($new) {
33 case PhameBlog::STATUS_ACTIVE:
34 return pht(
35 '%s published the blog %s.',
36 $this->renderAuthor(),
37 $this->renderObject());
38 case PhameBlog::STATUS_ARCHIVED:
39 return pht(
40 '%s archived the blog %s.',
41 $this->renderAuthor(),
42 $this->renderObject());
43 }
44 }
45
46 public function getIcon() {
47 $new = $this->getNewValue();
48 if ($new == PhameBlog::STATUS_ARCHIVED) {
49 return 'fa-ban';
50 } else {
51 return 'fa-check';
52 }
53 }
54
55}