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

Make logged-out users use global settings, not default settings

Summary: Fixes T11917. Give logged-out / omnipotent users the global settings, not the default settings.

Test Plan: Changed applications and language, logged out, saw changes as a public user.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11917

Differential Revision: https://secure.phabricator.com/D16936
This commit is contained in:
epriestley 2016-11-23 14:05:13 -08:00
parent 8958d68ec6
commit a1025ca52e

View file

@ -487,7 +487,7 @@ final class PhabricatorUser
if ($this->getPHID()) {
$settings = $this->requireCacheData($settings_key);
} else {
$settings = array();
$settings = $this->loadGlobalSettings();
}
// NOTE: To slightly improve performance, we're using all settings here,
@ -555,6 +555,20 @@ final class PhabricatorUser
return $this->getUserSetting(PhabricatorTimezoneSetting::SETTINGKEY);
}
private function loadGlobalSettings() {
$cache_key = 'user.settings.global';
$cache = PhabricatorCaches::getRequestCache();
$settings = $cache->getKey($cache_key);
if ($settings === null) {
$preferences = PhabricatorUserPreferences::loadGlobalPreferences($this);
$settings = $preferences->getPreferences();
$cache->setKey($cache_key, $settings);
}
return $settings;
}
/**
* Override the user's timezone identifier.