1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +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',
'DiffusionCommitActionTransaction' => 'applications/diffusion/xaction/DiffusionCommitActionTransaction.php',
'DiffusionCommitAffectedFilesHeraldField' => 'applications/diffusion/herald/DiffusionCommitAffectedFilesHeraldField.php',
'DiffusionCommitAuditStatus' => 'applications/diffusion/DiffusionCommitAuditStatus.php',
'DiffusionCommitAuditTransaction' => 'applications/diffusion/xaction/DiffusionCommitAuditTransaction.php',
'DiffusionCommitAuditorsHeraldField' => 'applications/diffusion/herald/DiffusionCommitAuditorsHeraldField.php',
'DiffusionCommitAuditorsTransaction' => 'applications/diffusion/xaction/DiffusionCommitAuditorsTransaction.php',
@ -2147,7 +2148,6 @@ phutil_register_library_map(array(
'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php',
'PhabricatorAuditApplication' => 'applications/audit/application/PhabricatorAuditApplication.php',
'PhabricatorAuditCommentEditor' => 'applications/audit/editor/PhabricatorAuditCommentEditor.php',
'PhabricatorAuditCommitStatusConstants' => 'applications/audit/constants/PhabricatorAuditCommitStatusConstants.php',
'PhabricatorAuditController' => 'applications/audit/controller/PhabricatorAuditController.php',
'PhabricatorAuditEditor' => 'applications/audit/editor/PhabricatorAuditEditor.php',
'PhabricatorAuditInlineComment' => 'applications/audit/storage/PhabricatorAuditInlineComment.php',
@ -6066,6 +6066,7 @@ phutil_register_library_map(array(
'DiffusionCommitAcceptTransaction' => 'DiffusionCommitAuditTransaction',
'DiffusionCommitActionTransaction' => 'DiffusionCommitTransactionType',
'DiffusionCommitAffectedFilesHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitAuditStatus' => 'Phobject',
'DiffusionCommitAuditTransaction' => 'DiffusionCommitActionTransaction',
'DiffusionCommitAuditorsHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitAuditorsTransaction' => 'DiffusionCommitTransactionType',
@ -7715,7 +7716,6 @@ phutil_register_library_map(array(
'PhabricatorAuditActionConstants' => 'Phobject',
'PhabricatorAuditApplication' => 'PhabricatorApplication',
'PhabricatorAuditCommentEditor' => 'PhabricatorEditor',
'PhabricatorAuditCommitStatusConstants' => 'Phobject',
'PhabricatorAuditController' => 'PhabricatorController',
'PhabricatorAuditEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorAuditInlineComment' => array(

View file

@ -68,17 +68,17 @@ final class AuditQueryConduitAPIMethod extends AuditConduitAPIMethod {
$status_map = array(
self::AUDIT_LEGACYSTATUS_OPEN => array(
PhabricatorAuditCommitStatusConstants::MODERN_NEEDS_AUDIT,
PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED,
DiffusionCommitAuditStatus::NEEDS_AUDIT,
DiffusionCommitAuditStatus::CONCERN_RAISED,
),
self::AUDIT_LEGACYSTATUS_CONCERN => array(
PhabricatorAuditCommitStatusConstants::MODERN_CONCERN_RAISED,
DiffusionCommitAuditStatus::CONCERN_RAISED,
),
self::AUDIT_LEGACYSTATUS_ACCEPTED => array(
PhabricatorAuditCommitStatusConstants::MODERN_AUDITED,
DiffusionCommitAuditStatus::AUDITED,
),
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'))
->setKey('statuses')
->setAliases(array('status'))
->setOptions(PhabricatorAuditCommitStatusConstants::newOptions())
->setOptions(DiffusionCommitAuditStatus::newOptions())
->setDeprecatedOptions(
PhabricatorAuditCommitStatusConstants::newDeprecatedOptions())
DiffusionCommitAuditStatus::newDeprecatedOptions())
->setDescription(pht('Find commits with given audit statuses.')),
id(new PhabricatorSearchDatasourceField())
->setLabel(pht('Repositories'))
@ -162,7 +162,7 @@ final class PhabricatorCommitSearchEngine
case 'active':
$bucket_key = DiffusionCommitRequiredActionResultBucket::BUCKETKEY;
$open = PhabricatorAuditCommitStatusConstants::getOpenStatusConstants();
$open = DiffusionCommitAuditStatus::getOpenStatusConstants();
$query
->setParameter('responsiblePHIDs', array($viewer_phid))

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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