1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01: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() { public function isInstalled() {
$uninstalled = PhabricatorEnv::getEnvConfig(
'phabricator.uninstalled-applications');
if (!$this->canUninstall()) { if (!$this->canUninstall()) {
return true; 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)]); return empty($uninstalled[get_class($this)]);
} }
@ -270,9 +275,6 @@ abstract class PhabricatorApplication {
public static function getAllInstalledApplications() { public static function getAllInstalledApplications() {
static $applications; static $applications;
$show_beta = PhabricatorEnv::getEnvConfig(
'phabricator.show-beta-applications');
if (empty($applications)) { if (empty($applications)) {
$all_applications = self::getAllApplications(); $all_applications = self::getAllApplications();
$apps = array(); $apps = array();
@ -285,10 +287,6 @@ abstract class PhabricatorApplication {
continue; continue;
} }
if (!$show_beta && $app->isBeta()) {
continue;
}
$apps[] = $app; $apps[] = $app;
} }

View file

@ -54,9 +54,19 @@ final class PhabricatorCoreConfigOptions
$this->newOption('phabricator.show-beta-applications', 'bool', false) $this->newOption('phabricator.show-beta-applications', 'bool', false)
->setBoolOptions( ->setBoolOptions(
array( array(
pht('Visible'), pht('Install Beta Applications'),
pht('Invisible') pht('Uninstall Beta Applications')
))->setDescription(pht('Show beta applications on the home page.')), ))
->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) $this->newOption('phabricator.serious-business', 'bool', false)
->setBoolOptions( ->setBoolOptions(
array( array(

View file

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

View file

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