1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Make "isInstalled()" respect beta apps

Summary:
Currently, `isInstalled()` and `getAllInstalledApplications()` are inconsistent:

  - `isInstalled()` returns true for beta apps, even if `phabricator.show-beta-applications` is false.
  - `getAllInstalledApplications()` omits beta apps if `phabricator.show-beta-applications` is false.

Making the beta config control installs (not just homepage visibility) makes far more sense as we roll out more thorough application integrations.

Make `isInstalled()` respect beta, and clean up some callsites.

D5602 builds on this.

Test Plan: Installed/uninstalled beta apps, verified Conpherence menu/panel and other application integrations dropped out of the UI.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D5603
This commit is contained in:
epriestley 2013-04-06 09:25:13 -07:00
parent a138641795
commit 97ff7fe259
4 changed files with 27 additions and 25 deletions

View file

@ -63,13 +63,18 @@ abstract class PhabricatorApplication {
}
public function isInstalled() {
$uninstalled = PhabricatorEnv::getEnvConfig(
'phabricator.uninstalled-applications');
if (!$this->canUninstall()) {
return true;
}
$beta = PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
if (!$beta && $this->isBeta()) {
return false;
}
$uninstalled = PhabricatorEnv::getEnvConfig(
'phabricator.uninstalled-applications');
return empty($uninstalled[get_class($this)]);
}
@ -270,9 +275,6 @@ abstract class PhabricatorApplication {
public static function getAllInstalledApplications() {
static $applications;
$show_beta = PhabricatorEnv::getEnvConfig(
'phabricator.show-beta-applications');
if (empty($applications)) {
$all_applications = self::getAllApplications();
$apps = array();
@ -285,10 +287,6 @@ abstract class PhabricatorApplication {
continue;
}
if (!$show_beta && $app->isBeta()) {
continue;
}
$apps[] = $app;
}

View file

@ -54,9 +54,19 @@ final class PhabricatorCoreConfigOptions
$this->newOption('phabricator.show-beta-applications', 'bool', false)
->setBoolOptions(
array(
pht('Visible'),
pht('Invisible')
))->setDescription(pht('Show beta applications on the home page.')),
pht('Install Beta Applications'),
pht('Uninstall Beta Applications')
))
->setDescription(
pht(
"Phabricator includes 'Beta' applications which are in an early ".
"stage of development. They range from very rough prototypes to ".
"relatively complete (but unpolished) applications.\n\n".
"By default, Beta applications are not installed. You can enable ".
"this option to install them if you're interested in previewing ".
"upcoming features.\n\n".
"After enabling Beta applications, you can selectively uninstall ".
"them (like normal applications).")),
$this->newOption('phabricator.serious-business', 'bool', false)
->setBoolOptions(
array(

View file

@ -4,14 +4,9 @@ final class PhabricatorSettingsPanelConpherencePreferences
extends PhabricatorSettingsPanel {
public function isEnabled() {
// TODO - epriestley - resolve isBeta and isInstalled for
// PhabricatorApplication
$app = PhabricatorApplication::getByClass(
$conpherence_app = PhabricatorApplication::getByClass(
'PhabricatorApplicationConpherence');
$is_prod = !$app->isBeta();
$allow_beta =
PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
return ($is_prod || $allow_beta) && $app->isInstalled();
return $conpherence_app->isInstalled();
}
public function getPanelKey() {

View file

@ -260,12 +260,11 @@ final class PhabricatorMainMenuView extends AphrontView {
'alert-notifications',
);
$conpherence = id(new PhabricatorApplicationConpherence())->isBeta();
$allow_beta =
PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
$message_tag = '';
$conpherence_application = PhabricatorApplication::getByClass(
'PhabricatorApplicationConpherence');
if (!$conpherence || $allow_beta) {
$message_tag = '';
if ($conpherence_application->isInstalled()) {
$message_id = celerity_generate_unique_node_id();
$message_count_id = celerity_generate_unique_node_id();