Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2630217
D25503.1732053018.diff
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
10 KB
Referenced Files
None
Subscribers
None
D25503.1732053018.diff
View Options
diff --git a/src/applications/audit/application/PhabricatorAuditApplication.php b/src/applications/audit/application/PhabricatorAuditApplication.php
--- a/src/applications/audit/application/PhabricatorAuditApplication.php
+++ b/src/applications/audit/application/PhabricatorAuditApplication.php
@@ -19,9 +19,7 @@
}
public function canUninstall() {
- // Audit was once a separate application, but has largely merged with
- // Diffusion.
- return false;
+ return true;
}
public function isPinnedByDefault(PhabricatorUser $viewer) {
diff --git a/src/applications/audit/conduit/AuditConduitAPIMethod.php b/src/applications/audit/conduit/AuditConduitAPIMethod.php
--- a/src/applications/audit/conduit/AuditConduitAPIMethod.php
+++ b/src/applications/audit/conduit/AuditConduitAPIMethod.php
@@ -4,7 +4,7 @@
final public function getApplication() {
return PhabricatorApplication::getByClass(
- 'PhabricatorDiffusionApplication');
+ 'PhabricatorAuditApplication');
}
}
diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php
--- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php
+++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php
@@ -70,6 +70,7 @@
}
protected function buildCustomSearchFields() {
+ $show_audit_fields = (id(new PhabricatorAuditApplication())->isInstalled());
$show_packages = PhabricatorApplication::isClassInstalled(
'PhabricatorPackagesApplication');
return array(
@@ -95,6 +96,7 @@
->setConduitKey('auditors')
->setAliases(array('auditor', 'auditors', 'auditorPHID'))
->setDatasource(new DiffusionAuditorFunctionDatasource())
+ ->setIsHidden(!$show_audit_fields)
->setDescription(
pht(
'Find commits where given users, projects, or packages are '.
@@ -106,6 +108,7 @@
->setOptions(DiffusionCommitAuditStatus::newOptions())
->setDeprecatedOptions(
DiffusionCommitAuditStatus::newDeprecatedOptions())
+ ->setIsHidden(!$show_audit_fields)
->setDescription(pht('Find commits with given audit statuses.')),
id(new PhabricatorSearchDatasourceField())
->setLabel(pht('Repositories'))
@@ -172,9 +175,13 @@
$names = array();
if ($this->requireViewer()->isLoggedIn()) {
- $names['active'] = pht('Active Audits');
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ $names['active'] = pht('Active Audits');
+ }
$names['authored'] = pht('Authored');
- $names['audited'] = pht('Audited');
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ $names['audited'] = pht('Audited');
+ }
}
$names['all'] = pht('All Commits');
@@ -224,9 +231,11 @@
$bucket = $this->getResultBucket($query);
+ // hide "Auditors" on /diffusion/commit/query/all/ if Audit not installed
+ $show_auditors = id(new PhabricatorAuditApplication())->isInstalled();
$template = id(new DiffusionCommitGraphView())
->setViewer($viewer)
- ->setShowAuditors(true);
+ ->setShowAuditors($show_auditors);
$views = array();
if ($bucket) {
diff --git a/src/applications/diffusion/editor/DiffusionCommitEditEngine.php b/src/applications/diffusion/editor/DiffusionCommitEditEngine.php
--- a/src/applications/diffusion/editor/DiffusionCommitEditEngine.php
+++ b/src/applications/diffusion/editor/DiffusionCommitEditEngine.php
@@ -100,19 +100,22 @@
$data = $object->getCommitData();
$fields = array();
-
- $fields[] = id(new PhabricatorDatasourceEditField())
- ->setKey('auditors')
- ->setLabel(pht('Auditors'))
- ->setDatasource(new DiffusionAuditorDatasource())
- ->setUseEdgeTransactions(true)
- ->setTransactionType(
- DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE)
- ->setCommentActionLabel(pht('Change Auditors'))
- ->setDescription(pht('Auditors for this commit.'))
- ->setConduitDescription(pht('Change the auditors for this commit.'))
- ->setConduitTypeDescription(pht('New auditors.'))
- ->setValue($object->getAuditorPHIDsForEdit());
+ // remove "Change Auditors" from "Add Action" dropdown etc
+ // if Audit is not installed
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ $fields[] = id(new PhabricatorDatasourceEditField())
+ ->setKey('auditors')
+ ->setLabel(pht('Auditors'))
+ ->setDatasource(new DiffusionAuditorDatasource())
+ ->setUseEdgeTransactions(true)
+ ->setTransactionType(
+ DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE)
+ ->setCommentActionLabel(pht('Change Auditors'))
+ ->setDescription(pht('Auditors for this commit.'))
+ ->setConduitDescription(pht('Change the auditors for this commit.'))
+ ->setConduitTypeDescription(pht('New auditors.'))
+ ->setValue($object->getAuditorPHIDsForEdit());
+ }
$actions = DiffusionCommitActionTransaction::loadAllActions();
$actions = msortv($actions, 'getCommitActionOrderVector');
diff --git a/src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php b/src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php
--- a/src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php
+++ b/src/applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php
@@ -9,8 +9,13 @@
return pht('Add auditors');
}
+ // hide "Add auditors" Herald action if Audit not installed
public function supportsRuleType($rule_type) {
- return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
+ } else {
+ return false;
+ }
}
public function applyEffect($object, HeraldEffect $effect) {
diff --git a/src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php b/src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php
--- a/src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php
+++ b/src/applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php
@@ -9,8 +9,13 @@
return pht('Add me as an auditor');
}
+ // hide "Add me as an auditor" Herald action if Audit not installed
public function supportsRuleType($rule_type) {
- return ($rule_type == HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ return ($rule_type == HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
+ } else {
+ return false;
+ }
}
public function applyEffect($object, HeraldEffect $effect) {
diff --git a/src/applications/diffusion/herald/DiffusionCommitAuditorsHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitAuditorsHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitAuditorsHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitAuditorsHeraldField.php
@@ -5,6 +5,15 @@
const FIELDCONST = 'diffusion.commit.auditors';
+ // hide "Auditors" Herald condition if Audit not installed
+ public function supportsObject($object) {
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ return ($object instanceof PhabricatorRepositoryCommit);
+ } else {
+ return false;
+ }
+ }
+
public function getHeraldFieldName() {
return pht('Auditors');
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php
@@ -5,6 +5,16 @@
const FIELDCONST = 'diffusion.commit.package.audit';
+ // hide "Affected packages that need audit" Herald condition
+ // if Audit not installed
+ public function supportsObject($object) {
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ return ($object instanceof PhabricatorRepositoryCommit);
+ } else {
+ return false;
+ }
+ }
+
public function getHeraldFieldName() {
return pht('Affected packages that need audit');
}
diff --git a/src/applications/diffusion/view/DiffusionCommitGraphView.php b/src/applications/diffusion/view/DiffusionCommitGraphView.php
--- a/src/applications/diffusion/view/DiffusionCommitGraphView.php
+++ b/src/applications/diffusion/view/DiffusionCommitGraphView.php
@@ -169,7 +169,10 @@
$this->addBuildAction($item_view, $hash);
}
- $this->addAuditAction($item_view, $hash);
+ // hide Audit entry on /diffusion/commit/query/all if Audit not installed
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ $this->addAuditAction($item_view, $hash);
+ }
if ($show_auditors) {
$auditor_list = $item_view->newMapView();
diff --git a/src/applications/diffusion/xaction/DiffusionCommitActionTransaction.php b/src/applications/diffusion/xaction/DiffusionCommitActionTransaction.php
--- a/src/applications/diffusion/xaction/DiffusionCommitActionTransaction.php
+++ b/src/applications/diffusion/xaction/DiffusionCommitActionTransaction.php
@@ -8,6 +8,9 @@
}
public function isActionAvailable($object, PhabricatorUser $viewer) {
+ if (!id(new PhabricatorAuditApplication())->isInstalled()) {
+ return false;
+ }
try {
$this->validateAction($object, $viewer);
return true;
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -275,16 +275,18 @@
->setOptions($orders);
}
- $buckets = $this->newResultBuckets();
- if ($query && $buckets) {
- $bucket_options = array(
- self::BUCKET_NONE => pht('No Bucketing'),
- ) + mpull($buckets, 'getResultBucketName');
-
- $fields[] = id(new PhabricatorSearchSelectField())
- ->setLabel(pht('Bucket'))
- ->setKey('bucket')
- ->setOptions($bucket_options);
+ if (id(new PhabricatorAuditApplication())->isInstalled()) {
+ $buckets = $this->newResultBuckets();
+ if ($query && $buckets) {
+ $bucket_options = array(
+ self::BUCKET_NONE => pht('No Bucketing'),
+ ) + mpull($buckets, 'getResultBucketName');
+
+ $fields[] = id(new PhabricatorSearchSelectField())
+ ->setLabel(pht('Bucket'))
+ ->setKey('bucket')
+ ->setOptions($bucket_options);
+ }
}
$field_map = array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 21:50 (21 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
979199
Default Alt Text
D25503.1732053018.diff (10 KB)
Attached To
Mode
D25503: Allow to uninstall (hide) Audit application
Attached
Detach File
Event Timeline
Log In to Comment