1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-03 12:12:43 +01:00

Rename "PhabricatorAuditCommitStatusConstants" to "DiffusionCommitAuditStatus"; remove "MODERN_"

Summary:
Depends on D19656. Ref T13197. See PHI851.

  - This class is now a real object, so get rid of the "Constants" part of the name.
  - Rename it for greater consistency with other modern objects.
  - Get rid of the `MODERN_` tag now that the old constants are gone.

Test Plan: Bunch of `grep`, browsed around.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13197

Differential Revision: https://secure.phabricator.com/D19657
This commit is contained in:
epriestley 2018-09-11 07:19:37 -07:00
parent aaf2269551
commit c7e7b63f15
10 changed files with 52 additions and 57 deletions

View file

@ -704,6 +704,7 @@ phutil_register_library_map(array(
'DiffusionCommitAcceptTransaction' => 'applications/diffusion/xaction/DiffusionCommitAcceptTransaction.php', 'DiffusionCommitAcceptTransaction' => 'applications/diffusion/xaction/DiffusionCommitAcceptTransaction.php',
'DiffusionCommitActionTransaction' => 'applications/diffusion/xaction/DiffusionCommitActionTransaction.php', 'DiffusionCommitActionTransaction' => 'applications/diffusion/xaction/DiffusionCommitActionTransaction.php',
'DiffusionCommitAffectedFilesHeraldField' => 'applications/diffusion/herald/DiffusionCommitAffectedFilesHeraldField.php', 'DiffusionCommitAffectedFilesHeraldField' => 'applications/diffusion/herald/DiffusionCommitAffectedFilesHeraldField.php',
'DiffusionCommitAuditStatus' => 'applications/diffusion/DiffusionCommitAuditStatus.php',
'DiffusionCommitAuditTransaction' => 'applications/diffusion/xaction/DiffusionCommitAuditTransaction.php', 'DiffusionCommitAuditTransaction' => 'applications/diffusion/xaction/DiffusionCommitAuditTransaction.php',
'DiffusionCommitAuditorsHeraldField' => 'applications/diffusion/herald/DiffusionCommitAuditorsHeraldField.php', 'DiffusionCommitAuditorsHeraldField' => 'applications/diffusion/herald/DiffusionCommitAuditorsHeraldField.php',
'DiffusionCommitAuditorsTransaction' => 'applications/diffusion/xaction/DiffusionCommitAuditorsTransaction.php', 'DiffusionCommitAuditorsTransaction' => 'applications/diffusion/xaction/DiffusionCommitAuditorsTransaction.php',
@ -2147,7 +2148,6 @@ phutil_register_library_map(array(
'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php', 'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php',
'PhabricatorAuditApplication' => 'applications/audit/application/PhabricatorAuditApplication.php', 'PhabricatorAuditApplication' => 'applications/audit/application/PhabricatorAuditApplication.php',
'PhabricatorAuditCommentEditor' => 'applications/audit/editor/PhabricatorAuditCommentEditor.php', 'PhabricatorAuditCommentEditor' => 'applications/audit/editor/PhabricatorAuditCommentEditor.php',
'PhabricatorAuditCommitStatusConstants' => 'applications/audit/constants/PhabricatorAuditCommitStatusConstants.php',
'PhabricatorAuditController' => 'applications/audit/controller/PhabricatorAuditController.php', 'PhabricatorAuditController' => 'applications/audit/controller/PhabricatorAuditController.php',
'PhabricatorAuditEditor' => 'applications/audit/editor/PhabricatorAuditEditor.php', 'PhabricatorAuditEditor' => 'applications/audit/editor/PhabricatorAuditEditor.php',
'PhabricatorAuditInlineComment' => 'applications/audit/storage/PhabricatorAuditInlineComment.php', 'PhabricatorAuditInlineComment' => 'applications/audit/storage/PhabricatorAuditInlineComment.php',
@ -6066,6 +6066,7 @@ phutil_register_library_map(array(
'DiffusionCommitAcceptTransaction' => 'DiffusionCommitAuditTransaction', 'DiffusionCommitAcceptTransaction' => 'DiffusionCommitAuditTransaction',
'DiffusionCommitActionTransaction' => 'DiffusionCommitTransactionType', 'DiffusionCommitActionTransaction' => 'DiffusionCommitTransactionType',
'DiffusionCommitAffectedFilesHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitAffectedFilesHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitAuditStatus' => 'Phobject',
'DiffusionCommitAuditTransaction' => 'DiffusionCommitActionTransaction', 'DiffusionCommitAuditTransaction' => 'DiffusionCommitActionTransaction',
'DiffusionCommitAuditorsHeraldField' => 'DiffusionCommitHeraldField', 'DiffusionCommitAuditorsHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitAuditorsTransaction' => 'DiffusionCommitTransactionType', 'DiffusionCommitAuditorsTransaction' => 'DiffusionCommitTransactionType',
@ -7715,7 +7716,6 @@ phutil_register_library_map(array(
'PhabricatorAuditActionConstants' => 'Phobject', 'PhabricatorAuditActionConstants' => 'Phobject',
'PhabricatorAuditApplication' => 'PhabricatorApplication', 'PhabricatorAuditApplication' => 'PhabricatorApplication',
'PhabricatorAuditCommentEditor' => 'PhabricatorEditor', 'PhabricatorAuditCommentEditor' => 'PhabricatorEditor',
'PhabricatorAuditCommitStatusConstants' => 'Phobject',
'PhabricatorAuditController' => 'PhabricatorController', 'PhabricatorAuditController' => 'PhabricatorController',
'PhabricatorAuditEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorAuditEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorAuditInlineComment' => array( 'PhabricatorAuditInlineComment' => array(

View file

@ -68,17 +68,17 @@ final class AuditQueryConduitAPIMethod extends AuditConduitAPIMethod {
$status_map = array( $status_map = array(
self::AUDIT_LEGACYSTATUS_OPEN => array( self::AUDIT_LEGACYSTATUS_OPEN => array(
PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_AUDIT, DiffusionCommitAuditStatus::NEEDS_AUDIT,
PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED, DiffusionCommitAuditStatus::CONCERN_RAISED,
), ),
self::AUDIT_LEGACYSTATUS_CONCERN => array( self::AUDIT_LEGACYSTATUS_CONCERN => array(
PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED, DiffusionCommitAuditStatus::CONCERN_RAISED,
), ),
self::AUDIT_LEGACYSTATUS_ACCEPTED => array( self::AUDIT_LEGACYSTATUS_ACCEPTED => array(
PhabricatorAuditCommitStatusConstants::MODERN_AUDITED, DiffusionCommitAuditStatus::AUDITED,
), ),
self::AUDIT_LEGACYSTATUS_PARTIAL => array( self::AUDIT_LEGACYSTATUS_PARTIAL => array(
PhabricatorAuditCommitStatusConstants::MODERN_PARTIALLY_AUDITED, DiffusionCommitAuditStatus::PARTIALLY_AUDITED,
), ),
); );

View file

@ -92,9 +92,9 @@ final class PhabricatorCommitSearchEngine
->setLabel(pht('Audit Status')) ->setLabel(pht('Audit Status'))
->setKey('statuses') ->setKey('statuses')
->setAliases(array('status')) ->setAliases(array('status'))
->setOptions(PhabricatorAuditCommitStatusConstants::newOptions()) ->setOptions(DiffusionCommitAuditStatus::newOptions())
->setDeprecatedOptions( ->setDeprecatedOptions(
PhabricatorAuditCommitStatusConstants::newDeprecatedOptions()) DiffusionCommitAuditStatus::newDeprecatedOptions())
->setDescription(pht('Find commits with given audit statuses.')), ->setDescription(pht('Find commits with given audit statuses.')),
id(new PhabricatorSearchDatasourceField()) id(new PhabricatorSearchDatasourceField())
->setLabel(pht('Repositories')) ->setLabel(pht('Repositories'))
@ -162,7 +162,7 @@ final class PhabricatorCommitSearchEngine
case 'active': case 'active':
$bucket_key = DiffusionCommitRequiredActionResultBucket::BUCKETKEY; $bucket_key = DiffusionCommitRequiredActionResultBucket::BUCKETKEY;
$open = PhabricatorAuditCommitStatusConstants::getOpenStatusConstants(); $open = DiffusionCommitAuditStatus::getOpenStatusConstants();
$query $query
->setParameter('responsiblePHIDs', array($viewer_phid)) ->setParameter('responsiblePHIDs', array($viewer_phid))

View file

@ -1,16 +1,16 @@
<?php <?php
final class PhabricatorAuditCommitStatusConstants extends Phobject { final class DiffusionCommitAuditStatus extends Phobject {
private $key; private $key;
private $spec = array(); private $spec = array();
const MODERN_NONE = 'none'; const NONE = 'none';
const MODERN_NEEDS_AUDIT = 'needs-audit'; const NEEDS_AUDIT = 'needs-audit';
const MODERN_CONCERN_RAISED = 'concern-raised'; const CONCERN_RAISED = 'concern-raised';
const MODERN_PARTIALLY_AUDITED = 'partially-audited'; const PARTIALLY_AUDITED = 'partially-audited';
const MODERN_AUDITED = 'audited'; const AUDITED = 'audited';
const MODERN_NEEDS_VERIFICATION = 'needs-verification'; const NEEDS_VERIFICATION = 'needs-verification';
public static function newModernKeys(array $values) { public static function newModernKeys(array $values) {
$map = self::getMap(); $map = self::getMap();
@ -59,27 +59,27 @@ final class PhabricatorAuditCommitStatusConstants extends Phobject {
} }
public function isNoAudit() { public function isNoAudit() {
return ($this->key == self::MODERN_NONE); return ($this->key == self::NONE);
} }
public function isNeedsAudit() { public function isNeedsAudit() {
return ($this->key == self::MODERN_NEEDS_AUDIT); return ($this->key == self::NEEDS_AUDIT);
} }
public function isConcernRaised() { public function isConcernRaised() {
return ($this->key == self::MODERN_CONCERN_RAISED); return ($this->key == self::CONCERN_RAISED);
} }
public function isNeedsVerification() { public function isNeedsVerification() {
return ($this->key == self::MODERN_NEEDS_VERIFICATION); return ($this->key == self::NEEDS_VERIFICATION);
} }
public function isPartiallyAudited() { public function isPartiallyAudited() {
return ($this->key == self::MODERN_PARTIALLY_AUDITED); return ($this->key == self::PARTIALLY_AUDITED);
} }
public function isAudited() { public function isAudited() {
return ($this->key == self::MODERN_AUDITED); return ($this->key == self::AUDITED);
} }
public function getIsClosed() { public function getIsClosed() {
@ -116,42 +116,42 @@ final class PhabricatorAuditCommitStatusConstants extends Phobject {
private static function getMap() { private static function getMap() {
return array( return array(
self::MODERN_NONE => array( self::NONE => array(
'name' => pht('No Audits'), 'name' => pht('No Audits'),
'legacy' => 0, 'legacy' => 0,
'icon' => 'fa-check', 'icon' => 'fa-check',
'color' => 'bluegrey', 'color' => 'bluegrey',
'closed' => true, 'closed' => true,
), ),
self::MODERN_NEEDS_AUDIT => array( self::NEEDS_AUDIT => array(
'name' => pht('Audit Required'), 'name' => pht('Audit Required'),
'legacy' => 1, 'legacy' => 1,
'icon' => 'fa-exclamation-circle', 'icon' => 'fa-exclamation-circle',
'color' => 'orange', 'color' => 'orange',
'closed' => false, 'closed' => false,
), ),
self::MODERN_CONCERN_RAISED => array( self::CONCERN_RAISED => array(
'name' => pht('Concern Raised'), 'name' => pht('Concern Raised'),
'legacy' => 2, 'legacy' => 2,
'icon' => 'fa-times-circle', 'icon' => 'fa-times-circle',
'color' => 'red', 'color' => 'red',
'closed' => false, 'closed' => false,
), ),
self::MODERN_PARTIALLY_AUDITED => array( self::PARTIALLY_AUDITED => array(
'name' => pht('Partially Audited'), 'name' => pht('Partially Audited'),
'legacy' => 3, 'legacy' => 3,
'icon' => 'fa-check-circle-o', 'icon' => 'fa-check-circle-o',
'color' => 'yellow', 'color' => 'yellow',
'closed' => false, 'closed' => false,
), ),
self::MODERN_AUDITED => array( self::AUDITED => array(
'name' => pht('Audited'), 'name' => pht('Audited'),
'legacy' => 4, 'legacy' => 4,
'icon' => 'fa-check-circle', 'icon' => 'fa-check-circle',
'color' => 'green', 'color' => 'green',
'closed' => true, 'closed' => true,
), ),
self::MODERN_NEEDS_VERIFICATION => array( self::NEEDS_VERIFICATION => array(
'name' => pht('Needs Verification'), 'name' => pht('Needs Verification'),
'legacy' => 5, 'legacy' => 5,
'icon' => 'fa-refresh', 'icon' => 'fa-refresh',

View file

@ -714,7 +714,7 @@ final class DiffusionCommitQuery
} }
if ($this->statuses !== null) { if ($this->statuses !== null) {
$statuses = PhabricatorAuditCommitStatusConstants::newModernKeys( $statuses = DiffusionCommitAuditStatus::newModernKeys(
$this->statuses); $this->statuses);
$where[] = qsprintf( $where[] = qsprintf(

View file

@ -33,8 +33,7 @@ final class DiffusionCommitConcernTransaction
public function applyInternalEffects($object, $value) { public function applyInternalEffects($object, $value) {
// NOTE: We force the commit directly into "Concern Raised" so that we // NOTE: We force the commit directly into "Concern Raised" so that we
// override a possible "Needs Verification" state. // override a possible "Needs Verification" state.
$object->setAuditStatus( $object->setAuditStatus(DiffusionCommitAuditStatus::CONCERN_RAISED);
PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED);
} }
public function applyExternalEffects($object, $value) { public function applyExternalEffects($object, $value) {

View file

@ -13,7 +13,7 @@ final class DiffusionCommitStateTransaction
private function getAuditStatusObject() { private function getAuditStatusObject() {
$new = $this->getNewValue(); $new = $this->getNewValue();
return PhabricatorAuditCommitStatusConstants::newForStatus($new); return DiffusionCommitAuditStatus::newForStatus($new);
} }
public function getIcon() { public function getIcon() {
@ -28,15 +28,15 @@ final class DiffusionCommitStateTransaction
$status = $this->getAuditStatusObject(); $status = $this->getAuditStatusObject();
switch ($status->getKey()) { switch ($status->getKey()) {
case PhabricatorAuditCommitStatusConstants::MODERN_NONE: case DiffusionCommitAuditStatus::NONE:
return pht('This commit no longer requires audit.'); return pht('This commit no longer requires audit.');
case PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_AUDIT: case DiffusionCommitAuditStatus::NEEDS_AUDIT:
return pht('This commit now requires audit.'); return pht('This commit now requires audit.');
case PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED: case DiffusionCommitAuditStatus::CONCERN_RAISED:
return pht('This commit now has outstanding concerns.'); return pht('This commit now has outstanding concerns.');
case PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_VERIFICATION: case DiffusionCommitAuditStatus::NEEDS_VERIFICATION:
return pht('This commit now requires verification by auditors.'); return pht('This commit now requires verification by auditors.');
case PhabricatorAuditCommitStatusConstants::MODERN_AUDITED: case DiffusionCommitAuditStatus::AUDITED:
return pht('All concerns with this commit have now been addressed.'); return pht('All concerns with this commit have now been addressed.');
} }
@ -47,23 +47,23 @@ final class DiffusionCommitStateTransaction
$status = $this->getAuditStatusObject(); $status = $this->getAuditStatusObject();
switch ($status->getKey()) { switch ($status->getKey()) {
case PhabricatorAuditCommitStatusConstants::MODERN_NONE: case DiffusionCommitAuditStatus::NONE:
return pht( return pht(
'%s no longer requires audit.', '%s no longer requires audit.',
$this->renderObject()); $this->renderObject());
case PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_AUDIT: case DiffusionCommitAuditStatus::NEEDS_AUDIT:
return pht( return pht(
'%s now requires audit.', '%s now requires audit.',
$this->renderObject()); $this->renderObject());
case PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED: case DiffusionCommitAuditStatus::CONCERN_RAISED:
return pht( return pht(
'%s now has outstanding concerns.', '%s now has outstanding concerns.',
$this->renderObject()); $this->renderObject());
case PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_VERIFICATION: case DiffusionCommitAuditStatus::NEEDS_VERIFICATION:
return pht( return pht(
'%s now requires verification by auditors.', '%s now requires verification by auditors.',
$this->renderObject()); $this->renderObject());
case PhabricatorAuditCommitStatusConstants::MODERN_AUDITED: case DiffusionCommitAuditStatus::AUDITED:
return pht( return pht(
'All concerns with %s have now been addressed.', 'All concerns with %s have now been addressed.',
$this->renderObject()); $this->renderObject());

View file

@ -36,8 +36,7 @@ final class DiffusionCommitVerifyTransaction
} }
public function applyInternalEffects($object, $value) { public function applyInternalEffects($object, $value) {
$object->setAuditStatus( $object->setAuditStatus(DiffusionCommitAuditStatus::NEEDS_VERIFICATION);
PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_VERIFICATION);
} }
protected function validateAction($object, PhabricatorUser $viewer) { protected function validateAction($object, PhabricatorUser $viewer) {

View file

@ -71,8 +71,7 @@ final class PhabricatorOwnersDetailController
'package' => $package->getPHID(), 'package' => $package->getPHID(),
)); ));
$status_concern = $status_concern = DiffusionCommitAuditStatus::CONCERN_RAISED;
PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED;
$attention_commits = id(new DiffusionCommitQuery()) $attention_commits = id(new DiffusionCommitQuery())
->setViewer($request->getUser()) ->setViewer($request->getUser())

View file

@ -27,7 +27,7 @@ final class PhabricatorRepositoryCommit
protected $epoch; protected $epoch;
protected $mailKey; protected $mailKey;
protected $authorPHID; protected $authorPHID;
protected $auditStatus = PhabricatorAuditCommitStatusConstants::MODERN_NONE; protected $auditStatus = DiffusionCommitAuditStatus::NONE;
protected $summary = ''; protected $summary = '';
protected $importStatus = 0; protected $importStatus = 0;
@ -385,22 +385,20 @@ final class PhabricatorRepositoryCommit
if ($this->isAuditStatusNeedsVerification()) { if ($this->isAuditStatusNeedsVerification()) {
// If the change is in "Needs Verification", we keep it there as // If the change is in "Needs Verification", we keep it there as
// long as any auditors still have concerns. // long as any auditors still have concerns.
$status = $status = DiffusionCommitAuditStatus::NEEDS_VERIFICATION;
PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_VERIFICATION;
} else { } else {
$status = PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED; $status = DiffusionCommitAuditStatus::CONCERN_RAISED;
} }
} else if ($any_accept) { } else if ($any_accept) {
if ($any_need) { if ($any_need) {
$status = $status = DiffusionCommitAuditStatus::PARTIALLY_AUDITED;
PhabricatorAuditCommitStatusConstants::MODERN_PARTIALLY_AUDITED;
} else { } else {
$status = PhabricatorAuditCommitStatusConstants::MODERN_AUDITED; $status = DiffusionCommitAuditStatus::AUDITED;
} }
} else if ($any_need) { } else if ($any_need) {
$status = PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_AUDIT; $status = DiffusionCommitAuditStatus::NEEDS_AUDIT;
} else { } else {
$status = PhabricatorAuditCommitStatusConstants::MODERN_NONE; $status = DiffusionCommitAuditStatus::NONE;
} }
return $this->setAuditStatus($status); return $this->setAuditStatus($status);
@ -531,7 +529,7 @@ final class PhabricatorRepositoryCommit
public function getAuditStatusObject() { public function getAuditStatusObject() {
$status = $this->getAuditStatus(); $status = $this->getAuditStatus();
return PhabricatorAuditCommitStatusConstants::newForStatus($status); return DiffusionCommitAuditStatus::newForStatus($status);
} }
public function isAuditStatusNoAudit() { public function isAuditStatusNoAudit() {