mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 10:41:08 +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:
parent
8958d68ec6
commit
a1025ca52e
1 changed files with 15 additions and 1 deletions
|
@ -487,7 +487,7 @@ final class PhabricatorUser
|
||||||
if ($this->getPHID()) {
|
if ($this->getPHID()) {
|
||||||
$settings = $this->requireCacheData($settings_key);
|
$settings = $this->requireCacheData($settings_key);
|
||||||
} else {
|
} else {
|
||||||
$settings = array();
|
$settings = $this->loadGlobalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: To slightly improve performance, we're using all settings here,
|
// NOTE: To slightly improve performance, we're using all settings here,
|
||||||
|
@ -555,6 +555,20 @@ final class PhabricatorUser
|
||||||
return $this->getUserSetting(PhabricatorTimezoneSetting::SETTINGKEY);
|
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.
|
* Override the user's timezone identifier.
|
||||||
|
|
Loading…
Reference in a new issue