diff --git a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php index ef72d41f80..2e4d1cb3a2 100644 --- a/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php +++ b/src/applications/meta/controller/PhabricatorApplicationDetailViewController.php @@ -36,7 +36,6 @@ final class PhabricatorApplicationDetailViewController if ($selected->isInstalled()) { $status_tag->setName(pht('Installed')); $status_tag->setBackgroundColor(PhabricatorTagView::COLOR_GREEN); - } else { $status_tag->setName(pht('Uninstalled')); $status_tag->setBackgroundColor(PhabricatorTagView::COLOR_RED); @@ -50,7 +49,6 @@ final class PhabricatorApplicationDetailViewController $header->addTag($beta_tag); } - $header->addTag($status_tag); $properties = $this->buildPropertyView($selected); @@ -93,13 +91,20 @@ final class PhabricatorApplicationDetailViewController ->setHref( $this->getApplicationURI(get_class($selected).'/uninstall/'))); } else { - $view->addAction( - id(new PhabricatorActionView()) - ->setName(pht('Install')) - ->setIcon('new') - ->setWorkflow(true) - ->setHref( - $this->getApplicationURI(get_class($selected).'/install/'))); + $action = id(new PhabricatorActionView()) + ->setName(pht('Install')) + ->setIcon('new') + ->setWorkflow(true) + ->setHref( + $this->getApplicationURI(get_class($selected).'/install/')); + + $beta_enabled = PhabricatorEnv::getEnvConfig( + 'phabricator.show-beta-applications'); + if ($selected->isBeta() && !$beta_enabled) { + $action->setDisabled(true); + } + + $view->addAction($action); } } else { $view->addAction( diff --git a/src/applications/meta/controller/PhabricatorApplicationUninstallController.php b/src/applications/meta/controller/PhabricatorApplicationUninstallController.php index 2bee35714b..7c480ad81e 100644 --- a/src/applications/meta/controller/PhabricatorApplicationUninstallController.php +++ b/src/applications/meta/controller/PhabricatorApplicationUninstallController.php @@ -23,31 +23,45 @@ final class PhabricatorApplicationUninstallController $view_uri = $this->getApplicationURI('view/'.$this->application); - if ($request->isDialogFormPost()) { - $this->manageApplication(); - return id(new AphrontRedirectResponse())->setURI($view_uri); - } + $beta_enabled = PhabricatorEnv::getEnvConfig( + 'phabricator.show-beta-applications'); $dialog = id(new AphrontDialogView()) ->setUser($user) ->addCancelButton($view_uri); + if ($selected->isBeta() && !$beta_enabled) { + $dialog + ->setTitle(pht('Beta Applications Not Enabled')) + ->appendChild( + pht( + 'To manage beta applications, enable them by setting %s in your '. + 'Phabricator configuration.', + phutil_tag('tt', array(), 'phabricator.show-beta-applications'))); + return id(new AphrontDialogResponse())->setDialog($dialog); + } + + if ($request->isDialogFormPost()) { + $this->manageApplication(); + return id(new AphrontRedirectResponse())->setURI($view_uri); + } + if ($this->action == 'install') { if ($selected->canUninstall()) { $dialog->setTitle('Confirmation') ->appendChild( - 'Install '. $selected->getName(). ' application ?') + 'Install '. $selected->getName(). ' application?') ->addSubmitButton('Install'); } else { $dialog->setTitle('Information') - ->appendChild('You cannot install a installed application.'); + ->appendChild('You cannot install an installed application.'); } } else { if ($selected->canUninstall()) { $dialog->setTitle('Confirmation') ->appendChild( - 'Really Uninstall '. $selected->getName(). ' application ?') + 'Really Uninstall '. $selected->getName(). ' application?') ->addSubmitButton('Uninstall'); } else { $dialog->setTitle('Information') @@ -65,7 +79,7 @@ final class PhabricatorApplicationUninstallController $list = $config_entry->getValue(); $uninstalled = PhabricatorEnv::getEnvConfig($key); - if ($uninstalled[$this->application]) { + if (isset($uninstalled[$this->application])) { unset($list[$this->application]); } else { $list[$this->application] = true;