From d92ed9ce0c0c00c9164cfadb6c024e7ea67fd084 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Thu, 4 Jan 2024 12:59:10 +0100 Subject: [PATCH] Hide "Packages" field in Diffusion Commits query form when application uninstalled Summary: Fixes T15698 Test Plan: 1. Uninstall Packages via `/applications/view/PhabricatorPackagesApplication/` 2. Go to `/diffusion/commit/`, expand the Query form, and see that `Packages` is not shown anymore Reviewers: O1 Blessed Committers, 20after4 Reviewed By: O1 Blessed Committers, 20after4 Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15698 Differential Revision: https://we.phorge.it/D25506 --- src/applications/audit/query/PhabricatorCommitSearchEngine.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php index 8b7751c795..7251857c7f 100644 --- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php +++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php @@ -70,6 +70,8 @@ final class PhabricatorCommitSearchEngine } protected function buildCustomSearchFields() { + $show_packages = PhabricatorApplication::isClassInstalled( + 'PhabricatorPackagesApplication'); return array( id(new PhabricatorSearchDatasourceField()) ->setLabel(pht('Responsible Users')) @@ -118,6 +120,7 @@ final class PhabricatorCommitSearchEngine ->setConduitKey('packages') ->setAliases(array('package', 'packages', 'packagePHID')) ->setDatasource(new PhabricatorOwnersPackageDatasource()) + ->setIsHidden(!$show_packages) ->setDescription( pht('Find commits which affect given packages.')), id(new PhabricatorSearchThreeStateField())