diff --git a/src/applications/home/application/PhabricatorHomeApplication.php b/src/applications/home/application/PhabricatorHomeApplication.php --- a/src/applications/home/application/PhabricatorHomeApplication.php +++ b/src/applications/home/application/PhabricatorHomeApplication.php @@ -2,6 +2,7 @@ final class PhabricatorHomeApplication extends PhabricatorApplication { + private $quickItems; const DASHBOARD_DEFAULT = 'dashboard:default'; public function getBaseURI() { @@ -42,6 +43,11 @@ PhabricatorUser $user, PhabricatorController $controller = null) { + $quick_items = $this->getQuickActionItems($user); + if (!$quick_items) { + return array(); + } + $items = array(); $create_id = celerity_generate_unique_node_id(); @@ -73,7 +79,7 @@ PhabricatorUser $viewer, PhabricatorController $controller = null) { - $items = PhabricatorQuickActions::loadMenuItemsForUser($viewer); + $items = $this->getQuickActionItems($viewer); $view = null; if ($items) { @@ -94,4 +100,12 @@ return $view; } + private function getQuickActionItems(PhabricatorUser $viewer) { + if ($this->quickItems === null) { + $items = PhabricatorQuickActions::loadMenuItemsForUser($viewer); + $this->quickItems = $items; + } + return $this->quickItems; + } + } diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -486,7 +486,10 @@ $settings = array(); } - $defaults = PhabricatorSetting::getAllEnabledSettings($this); + // NOTE: To slightly improve performance, we're using all settings here, + // not just settings that are enabled for the current viewer. It's fine to + // get the value of a setting that we wouldn't let the user edit in the UI. + $defaults = PhabricatorSetting::getAllSettings(); if (array_key_exists($key, $settings)) { $value = $settings[$key]; diff --git a/src/applications/settings/setting/PhabricatorTranslationSetting.php b/src/applications/settings/setting/PhabricatorTranslationSetting.php --- a/src/applications/settings/setting/PhabricatorTranslationSetting.php +++ b/src/applications/settings/setting/PhabricatorTranslationSetting.php @@ -26,6 +26,11 @@ 'Choose which language you would like the Phabricator UI to use.'); } + public function assertValidValue($value) { + $locales = PhutilLocale::loadAllLocales(); + return isset($locales[$value]); + } + protected function getSelectOptionGroups() { $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); $locales = PhutilLocale::loadAllLocales();