@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 184 lines 4.5 kB view raw
1<?php 2 3final class DifferentialRevisionStatus extends Phobject { 4 5 const NEEDS_REVIEW = 'needs-review'; 6 const NEEDS_REVISION = 'needs-revision'; 7 const CHANGES_PLANNED = 'changes-planned'; 8 const ACCEPTED = 'accepted'; 9 const PUBLISHED = 'published'; 10 const ABANDONED = 'abandoned'; 11 const DRAFT = 'draft'; 12 13 private $key; 14 private $spec = array(); 15 16 public function getKey() { 17 return $this->key; 18 } 19 20 public function getLegacyKey() { 21 return idx($this->spec, 'legacy'); 22 } 23 24 public function getIcon() { 25 return idx($this->spec, 'icon'); 26 } 27 28 public function getIconColor() { 29 return idx($this->spec, 'color.icon', 'bluegrey'); 30 } 31 32 public function getTagColor() { 33 return idx($this->spec, 'color.tag', 'bluegrey'); 34 } 35 36 public function getTimelineIcon() { 37 return idx($this->spec, 'icon.timeline'); 38 } 39 40 public function getTimelineColor() { 41 return idx($this->spec, 'color.timeline'); 42 } 43 44 public function getANSIColor() { 45 return idx($this->spec, 'color.ansi'); 46 } 47 48 public function getDisplayName() { 49 return idx($this->spec, 'name'); 50 } 51 52 public function isClosedStatus() { 53 return idx($this->spec, 'closed'); 54 } 55 56 public function isAbandoned() { 57 return ($this->key === self::ABANDONED); 58 } 59 60 public function isAccepted() { 61 return ($this->key === self::ACCEPTED); 62 } 63 64 public function isNeedsReview() { 65 return ($this->key === self::NEEDS_REVIEW); 66 } 67 68 public function isNeedsRevision() { 69 return ($this->key === self::NEEDS_REVISION); 70 } 71 72 public function isPublished() { 73 return ($this->key === self::PUBLISHED); 74 } 75 76 public function isChangePlanned() { 77 return ($this->key === self::CHANGES_PLANNED); 78 } 79 80 public function isDraft() { 81 return ($this->key === self::DRAFT); 82 } 83 84 public static function newForStatus($status) { 85 $result = new self(); 86 87 $map = self::getMap(); 88 if (isset($map[$status])) { 89 $result->key = $status; 90 $result->spec = $map[$status]; 91 } 92 93 return $result; 94 } 95 96 public static function getAll() { 97 $result = array(); 98 99 foreach (self::getMap() as $key => $spec) { 100 $result[$key] = self::newForStatus($key); 101 } 102 103 return $result; 104 } 105 106 private static function getMap() { 107 $close_on_accept = PhabricatorEnv::getEnvConfig( 108 'differential.close-on-accept'); 109 110 return array( 111 self::NEEDS_REVIEW => array( 112 'name' => pht('Needs Review'), 113 'legacy' => 0, 114 'icon' => 'fa-code', 115 'icon.timeline' => 'fa-undo', 116 'closed' => false, 117 'color.icon' => 'grey', 118 'color.tag' => 'bluegrey', 119 'color.ansi' => 'magenta', 120 'color.timeline' => 'orange', 121 ), 122 self::NEEDS_REVISION => array( 123 'name' => pht('Needs Revision'), 124 'legacy' => 1, 125 'icon' => 'fa-refresh', 126 'icon.timeline' => 'fa-times', 127 'closed' => false, 128 'color.icon' => 'red', 129 'color.tag' => 'red', 130 'color.ansi' => 'red', 131 'color.timeline' => 'red', 132 ), 133 self::CHANGES_PLANNED => array( 134 'name' => pht('Changes Planned'), 135 'legacy' => 5, 136 'icon' => 'fa-headphones', 137 'closed' => false, 138 'color.icon' => 'red', 139 'color.tag' => 'red', 140 'color.ansi' => 'red', 141 ), 142 self::ACCEPTED => array( 143 'name' => pht('Accepted'), 144 'legacy' => 2, 145 'icon' => 'fa-check', 146 'icon.timeline' => 'fa-check', 147 'closed' => $close_on_accept, 148 'color.icon' => 'green', 149 'color.tag' => 'green', 150 'color.ansi' => 'green', 151 'color.timeline' => 'green', 152 ), 153 self::PUBLISHED => array( 154 'name' => pht('Closed'), 155 'legacy' => 3, 156 'icon' => 'fa-check-square-o', 157 'closed' => true, 158 'color.icon' => 'black', 159 'color.tag' => 'indigo', 160 'color.ansi' => 'cyan', 161 ), 162 self::ABANDONED => array( 163 'name' => pht('Abandoned'), 164 'legacy' => 4, 165 'icon' => 'fa-plane', 166 'closed' => true, 167 'color.icon' => 'black', 168 'color.tag' => 'indigo', 169 'color.ansi' => null, 170 ), 171 self::DRAFT => array( 172 'name' => pht('Draft'), 173 // For legacy clients, treat this as though it is "Needs Review". 174 'legacy' => 0, 175 'icon' => 'fa-spinner', 176 'closed' => false, 177 'color.icon' => 'pink', 178 'color.tag' => 'pink', 179 'color.ansi' => null, 180 ), 181 ); 182 } 183 184}