@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve some settings-related performance

Summary:
Ref T4103. Two small improvements:

- Don't work as hard to validate translations. We just need to know if a translation exists, we don't need to count how many strings it has and build the entire menu.
- Allow `getUserSetting()` to work on any setting without doing all the application/visibility checks. It's OK for code to look at, say, your "Conpherence Notifications" setting even if that application is not installed for you.

Test Plan: Used XHProf and saw 404 page drop from ~60ms to ~40ms locally.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4103

Differential Revision: https://secure.phabricator.com/D16046

+24 -2
+15 -1
src/applications/home/application/PhabricatorHomeApplication.php
··· 2 2 3 3 final class PhabricatorHomeApplication extends PhabricatorApplication { 4 4 5 + private $quickItems; 5 6 const DASHBOARD_DEFAULT = 'dashboard:default'; 6 7 7 8 public function getBaseURI() { ··· 42 43 PhabricatorUser $user, 43 44 PhabricatorController $controller = null) { 44 45 46 + $quick_items = $this->getQuickActionItems($user); 47 + if (!$quick_items) { 48 + return array(); 49 + } 50 + 45 51 $items = array(); 46 52 $create_id = celerity_generate_unique_node_id(); 47 53 ··· 73 79 PhabricatorUser $viewer, 74 80 PhabricatorController $controller = null) { 75 81 76 - $items = PhabricatorQuickActions::loadMenuItemsForUser($viewer); 82 + $items = $this->getQuickActionItems($viewer); 77 83 78 84 $view = null; 79 85 if ($items) { ··· 92 98 $view); 93 99 } 94 100 return $view; 101 + } 102 + 103 + private function getQuickActionItems(PhabricatorUser $viewer) { 104 + if ($this->quickItems === null) { 105 + $items = PhabricatorQuickActions::loadMenuItemsForUser($viewer); 106 + $this->quickItems = $items; 107 + } 108 + return $this->quickItems; 95 109 } 96 110 97 111 }
+4 -1
src/applications/people/storage/PhabricatorUser.php
··· 486 486 $settings = array(); 487 487 } 488 488 489 - $defaults = PhabricatorSetting::getAllEnabledSettings($this); 489 + // NOTE: To slightly improve performance, we're using all settings here, 490 + // not just settings that are enabled for the current viewer. It's fine to 491 + // get the value of a setting that we wouldn't let the user edit in the UI. 492 + $defaults = PhabricatorSetting::getAllSettings(); 490 493 491 494 if (array_key_exists($key, $settings)) { 492 495 $value = $settings[$key];
+5
src/applications/settings/setting/PhabricatorTranslationSetting.php
··· 26 26 'Choose which language you would like the Phabricator UI to use.'); 27 27 } 28 28 29 + public function assertValidValue($value) { 30 + $locales = PhutilLocale::loadAllLocales(); 31 + return isset($locales[$value]); 32 + } 33 + 29 34 protected function getSelectOptionGroups() { 30 35 $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); 31 36 $locales = PhutilLocale::loadAllLocales();