Page MenuHomePhorge

Do not expose "Packages" field as Audit query form field when Packages application uninstalled
Closed, ResolvedPublic

Description

The "Packages" application can be uninstalled on http://phorge.localhost/applications/view/PhabricatorPackagesApplication/.
Once uninstalled, I'd expect the query form fields on http://phorge.localhost/diffusion/commit/ not to expose a PhabricatorSearchDatasourceField labeled "Packages" anymore.

Could likely check for id(new PhabricatorPackagesApplication())->isInstalled() but no idea how to best do that within an array definition without duplicating lots of code: https://we.phorge.it/source/phorge/browse/master/src/applications/audit/query/PhabricatorCommitSearchEngine.php$115-122
Ternary operator cannot be applied to an additional single ->setIsHidden(true) line...

Ideas welcome.

Event Timeline

Argh, note to myself: Simply define $hide_packages = (!id(new PhabricatorPackagesApplication())->isInstalled()); and add ->setIsHidden($hide_packages)...

@20after4 suggested an "is-application-installed"-aware class-finder recently - I wonder if that would also handle this?

I think it might be applicable here and in several other places that follow the general pattern of “look up all subclasses of a given feature and then loop over all of them to run extension hooks “