@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 PhabricatorTransactions extends Phobject {
4
5 const TYPE_COMMENT = 'core:comment';
6 const TYPE_SUBSCRIBERS = 'core:subscribers';
7 const TYPE_VIEW_POLICY = 'core:view-policy';
8 const TYPE_EDIT_POLICY = 'core:edit-policy';
9 const TYPE_JOIN_POLICY = 'core:join-policy';
10 const TYPE_INTERACT_POLICY = 'core:interact-policy';
11 const TYPE_EDGE = 'core:edge';
12 const TYPE_CUSTOMFIELD = 'core:customfield';
13 const TYPE_TOKEN = 'token:give';
14 const TYPE_INLINESTATE = 'core:inlinestate';
15 const TYPE_SPACE = 'core:space';
16 const TYPE_CREATE = 'core:create';
17 const TYPE_COLUMNS = 'core:columns';
18 const TYPE_SUBTYPE = 'core:subtype';
19 const TYPE_HISTORY = 'core:history';
20 const TYPE_MFA = 'core:mfa';
21 const TYPE_FILE = 'core:file';
22
23 const COLOR_RED = 'red';
24 const COLOR_ORANGE = 'orange';
25 const COLOR_YELLOW = 'yellow';
26 const COLOR_GREEN = 'green';
27 const COLOR_SKY = 'sky';
28 const COLOR_BLUE = 'blue';
29 const COLOR_INDIGO = 'indigo';
30 const COLOR_VIOLET = 'violet';
31 const COLOR_GREY = 'grey';
32 const COLOR_BLACK = 'black';
33
34
35 public static function getInlineStateMap() {
36 return array(
37 PhabricatorInlineComment::STATE_DRAFT =>
38 PhabricatorInlineComment::STATE_DONE,
39 PhabricatorInlineComment::STATE_UNDRAFT =>
40 PhabricatorInlineComment::STATE_UNDONE,
41 );
42 }
43
44 /**
45 * Find the first transaction that matches a type.
46 * @param array $xactions
47 * @param string $type
48 * @return PhabricatorTransactions|null
49 */
50 public static function findOneByType($xactions, $type) {
51 foreach ($xactions as $xaction) {
52 if ($xaction->getTransactionType() === $type) {
53 return $xaction;
54 }
55 }
56 return null;
57 }
58
59}