1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-02 02:40:58 +01:00

Fix some beta/install Application issues

Summary:
Currently, we give you an "Install" button for Beta apps even when "phabricator.show-beta-applications" is disabled. This is unclear.

Instead, disable the button and tell the user about the config when it is clicked.

Arguably, we should restructure this so you can selectively install "Beta" apps without setting the config, but almost all the beta apps are terrible so just make things consistent for now.

Test Plan: Tried to install a beta app without beta apps enabled.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D5652
This commit is contained in:
epriestley 2013-04-10 14:52:20 -07:00
parent 9087e4805e
commit 9bbce8de42
2 changed files with 36 additions and 17 deletions

View file

@ -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(

View file

@ -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;