Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892715
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
4 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
index 31bb2c22f7..877fd0b4ba 100644
--- a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
+++ b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
@@ -1,92 +1,96 @@
<?php
final class PhabricatorAuditCommitStatusConstants extends Phobject {
const NONE = 0;
const NEEDS_AUDIT = 1;
const CONCERN_RAISED = 2;
const PARTIALLY_AUDITED = 3;
const FULLY_AUDITED = 4;
const NEEDS_VERIFICATION = 5;
- public static function getStatusNameMap() {
- $map = array(
- self::NONE => pht('No Audits'),
- self::NEEDS_AUDIT => pht('Audit Required'),
- self::CONCERN_RAISED => pht('Concern Raised'),
- self::NEEDS_VERIFICATION => pht('Needs Verification'),
- self::PARTIALLY_AUDITED => pht('Partially Audited'),
- self::FULLY_AUDITED => pht('Audited'),
- );
+ const MODERN_NONE = 'none';
+ const MODERN_NEEDS_AUDIT = 'needs-audit';
+ const MODERN_CONCERN_RAISED = 'concern-raised';
+ const MODERN_PARTIALLY_AUDITED = 'partially-audited';
+ const MODERN_AUDITED = 'audited';
+ const MODERN_NEEDS_VERIFICATION = 'needs-verification';
- return $map;
+ public static function getStatusNameMap() {
+ $map = self::getMap();
+ return ipull($map, 'name', 'legacy');
}
public static function getStatusName($code) {
return idx(self::getStatusNameMap(), $code, pht('Unknown'));
}
public static function getOpenStatusConstants() {
- return array(
- self::CONCERN_RAISED,
- self::NEEDS_AUDIT,
- self::NEEDS_VERIFICATION,
- self::PARTIALLY_AUDITED,
- );
+ $constants = array();
+ foreach (self::getMap() as $map) {
+ if (!$map['closed']) {
+ $constants[] = $map['legacy'];
+ }
+ }
+ return $constants;
}
public static function getStatusColor($code) {
- switch ($code) {
- case self::CONCERN_RAISED:
- $color = 'red';
- break;
- case self::NEEDS_AUDIT:
- $color = 'orange';
- break;
- case self::PARTIALLY_AUDITED:
- $color = 'yellow';
- break;
- case self::FULLY_AUDITED:
- $color = 'green';
- break;
- case self::NONE:
- $color = 'bluegrey';
- break;
- case self::NEEDS_VERIFICATION:
- $color = 'indigo';
- break;
- default:
- $color = null;
- break;
- }
- return $color;
+ $map = self::getMap();
+ $map = ipull($map, 'color', 'legacy');
+ return idx($map, $code);
}
public static function getStatusIcon($code) {
- switch ($code) {
- case self::CONCERN_RAISED:
- $icon = 'fa-times-circle';
- break;
- case self::NEEDS_AUDIT:
- $icon = 'fa-exclamation-circle';
- break;
- case self::PARTIALLY_AUDITED:
- $icon = 'fa-check-circle-o';
- break;
- case self::FULLY_AUDITED:
- $icon = 'fa-check-circle';
- break;
- case self::NONE:
- $icon = 'fa-check';
- break;
- case self::NEEDS_VERIFICATION:
- $icon = 'fa-refresh';
- break;
- default:
- $icon = null;
- break;
- }
- return $icon;
+ $map = self::getMap();
+ $map = ipull($map, 'icon', 'legacy');
+ return idx($map, $code);
}
+ private static function getMap() {
+ return array(
+ self::MODERN_NONE => array(
+ 'name' => pht('No Audits'),
+ 'legacy' => self::NONE,
+ 'icon' => 'fa-check',
+ 'color' => 'bluegrey',
+ 'closed' => true,
+ ),
+ self::MODERN_NEEDS_AUDIT => array(
+ 'name' => pht('Audit Required'),
+ 'legacy' => self::NEEDS_AUDIT,
+ 'icon' => 'fa-exclamation-circle',
+ 'color' => 'orange',
+ 'closed' => false,
+ ),
+ self::MODERN_CONCERN_RAISED => array(
+ 'name' => pht('Concern Raised'),
+ 'legacy' => self::CONCERN_RAISED,
+ 'icon' => 'fa-times-circle',
+ 'color' => 'red',
+ 'closed' => false,
+ ),
+ self::MODERN_PARTIALLY_AUDITED => array(
+ 'name' => pht('Partially Audited'),
+ 'legacy' => self::PARTIALLY_AUDITED,
+ 'icon' => 'fa-check-circle-o',
+ 'color' => 'yellow',
+ 'closed' => false,
+ ),
+ self::MODERN_AUDITED => array(
+ 'name' => pht('Audited'),
+ 'legacy' => self::FULLY_AUDITED,
+ 'icon' => 'fa-check-circle',
+ 'color' => 'green',
+ 'closed' => true,
+ ),
+ self::MODERN_NEEDS_VERIFICATION => array(
+ 'name' => pht('Needs Verification'),
+ 'legacy' => self::NEEDS_VERIFICATION,
+ 'icon' => 'fa-refresh',
+ 'color' => 'indigo',
+ 'closed' => false,
+ ),
+ );
+ }
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 17:14 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126853
Default Alt Text
(4 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment