From aeb3a12e13aedb93711fad2081895b31c5ce836e Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Wed, 12 Nov 2014 11:31:54 -0800 Subject: [PATCH] Config - improve lock message for option `phabricator.uninstalled-applications` Summary: Fixes T6175. This particular option is only editable via the Applications application so let the user know that. Test Plan: saw error message and clicked through to applications app. tried another locked option and saw old message Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6175 Differential Revision: https://secure.phabricator.com/D10841 --- .../PhabricatorConfigEditController.php | 4 +--- .../config/option/PhabricatorConfigOption.php | 15 +++++++++++++++ .../option/PhabricatorCoreConfigOptions.php | 9 +++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php index 5983d4cb44..41d6ccc391 100644 --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -120,10 +120,8 @@ final class PhabricatorConfigEditController ->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->appendChild(phutil_tag('p', array(), $msg)); } else if ($option->getLocked()) { - $msg = pht( - 'This configuration is locked and can not be edited from the web '. - 'interface. Use `./bin/config` in `phabricator/` to edit it.'); + $msg = $option->getLockedMessage(); $error_view = id(new AphrontErrorView()) ->setTitle(pht('Configuration Locked')) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php index 1c0c090b08..b2e6a0e85d 100644 --- a/src/applications/config/option/PhabricatorConfigOption.php +++ b/src/applications/config/option/PhabricatorConfigOption.php @@ -14,6 +14,7 @@ final class PhabricatorConfigOption private $group; private $examples; private $locked; + private $lockedMessage; private $hidden; private $masked; private $baseClass; @@ -85,6 +86,20 @@ final class PhabricatorConfigOption false); } + public function setLockedMessage($message) { + $this->lockedMessage = $message; + return $this; + } + + public function getLockedMessage() { + if ($this->lockedMessage !== null) { + return $this->lockedMessage; + } + return pht( + 'This configuration is locked and can not be edited from the web '. + 'interface. Use `./bin/config` in `phabricator/` to edit it.'); + } + public function addExample($value, $description) { $this->examples[] = array($value, $description); return $this; diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php index d846155a99..068d1197d5 100644 --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -27,6 +27,7 @@ final class PhabricatorCoreConfigOptions $proto_doc_href = PhabricatorEnv::getDoclink( 'User Guide: Prototype Applications'); $proto_doc_name = pht('User Guide: Prototype Applications'); + $applications_app_href = '/applications/'; return array( $this->newOption('phabricator.base-uri', 'string', null) @@ -183,6 +184,14 @@ final class PhabricatorCoreConfigOptions ->setDescription(pht('Unit test value.')), $this->newOption('phabricator.uninstalled-applications', 'set', array()) ->setLocked(true) + ->setLockedMessage(pht( + 'Use the %s to manage installed applications.', + phutil_tag( + 'a', + array( + 'href' => $applications_app_href, + ), + pht('Applications application')))) ->setDescription( pht('Array containing list of Uninstalled applications.')), $this->newOption('phabricator.application-settings', 'wild', array())