diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index 2ba5d2b2cd..0d450c5a88 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -505,13 +505,13 @@ final class PhabricatorUser ->setViewer($this) ->assertValidValue($value); - $this->settingCacheKeys[$key] = true; - $this->settingCache[$key] = $value; - - return $value; + return $this->writeUserSettingCache($key, $value); } catch (Exception $ex) { // Fall through below and return the default value. } + } else { + // This is an ad-hoc setting with no controlling object. + return $this->writeUserSettingCache($key, $value); } } @@ -523,10 +523,7 @@ final class PhabricatorUser $value = null; } - $this->settingCacheKeys[$key] = true; - $this->settingCache[$key] = $value; - - return $value; + return $this->writeUserSettingCache($key, $value); } @@ -557,6 +554,12 @@ final class PhabricatorUser return $this; } + private function writeUserSettingCache($key, $value) { + $this->settingCacheKeys[$key] = true; + $this->settingCache[$key] = $value; + return $value; + } + public function getTranslation() { return $this->getUserSetting(PhabricatorTranslationSetting::SETTINGKEY); }