Page MenuHomePhabricator

D16043.id38609.diff
No OneTemporary

D16043.id38609.diff

diff --git a/src/applications/people/cache/PhabricatorUserCacheType.php b/src/applications/people/cache/PhabricatorUserCacheType.php
--- a/src/applications/people/cache/PhabricatorUserCacheType.php
+++ b/src/applications/people/cache/PhabricatorUserCacheType.php
@@ -27,11 +27,7 @@
}
public function getValueFromStorage($value) {
- return phutil_json_decode($value);
- }
-
- public function getValueForStorage($value) {
- return phutil_json_encode($value);
+ return $value;
}
public function newValueForUsers($key, array $users) {
diff --git a/src/applications/people/cache/PhabricatorUserMessageCountCacheType.php b/src/applications/people/cache/PhabricatorUserMessageCountCacheType.php
--- a/src/applications/people/cache/PhabricatorUserMessageCountCacheType.php
+++ b/src/applications/people/cache/PhabricatorUserMessageCountCacheType.php
@@ -21,10 +21,6 @@
return (int)$value;
}
- public function getValueForStorage($value) {
- return $value;
- }
-
public function newValueForUsers($key, array $users) {
if (!$users) {
return array();
diff --git a/src/applications/people/cache/PhabricatorUserNotificationCountCacheType.php b/src/applications/people/cache/PhabricatorUserNotificationCountCacheType.php
--- a/src/applications/people/cache/PhabricatorUserNotificationCountCacheType.php
+++ b/src/applications/people/cache/PhabricatorUserNotificationCountCacheType.php
@@ -21,10 +21,6 @@
return (int)$value;
}
- public function getValueForStorage($value) {
- return $value;
- }
-
public function newValueForUsers($key, array $users) {
if (!$users) {
return array();
diff --git a/src/applications/people/cache/PhabricatorUserPreferencesCacheType.php b/src/applications/people/cache/PhabricatorUserPreferencesCacheType.php
--- a/src/applications/people/cache/PhabricatorUserPreferencesCacheType.php
+++ b/src/applications/people/cache/PhabricatorUserPreferencesCacheType.php
@@ -17,6 +17,10 @@
return ($key === self::KEY_PREFERENCES);
}
+ public function getValueFromStorage($value) {
+ return phutil_json_decode($value);
+ }
+
public function newValueForUsers($key, array $users) {
$viewer = $this->getViewer();
@@ -27,9 +31,15 @@
->withUserPHIDs($user_phids)
->execute();
- $empty = array_fill_keys($user_phids, array());
+ $settings = mpull($preferences, 'getPreferences', 'getUserPHID');
+
+ $results = array();
+ foreach ($user_phids as $user_phid) {
+ $value = idx($settings, $user_phid, array());
+ $results[$user_phid] = phutil_json_encode($value);
+ }
- return mpull($preferences, 'getPreferences', 'getUserPHID') + $empty;
+ return $results;
}
}
diff --git a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
--- a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
+++ b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
@@ -17,6 +17,10 @@
return ($key === self::KEY_URI);
}
+ public function getDefaultValue() {
+ return PhabricatorUser::getDefaultProfileImageURI();
+ }
+
public function newValueForUsers($key, array $users) {
$viewer = $this->getViewer();
@@ -55,10 +59,6 @@
return end($parts);
}
- public function getValueForStorage($value) {
- return $value;
- }
-
public function shouldValidateRawCacheData() {
return true;
}
diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php
--- a/src/applications/people/query/PhabricatorPeopleQuery.php
+++ b/src/applications/people/query/PhabricatorPeopleQuery.php
@@ -544,8 +544,7 @@
$data = $type->newValueForUsers($cache_key, $need_users);
- foreach ($data as $user_phid => $value) {
- $raw_value = $type->getValueForStorage($value);
+ foreach ($data as $user_phid => $raw_value) {
$data[$user_phid] = $raw_value;
$writes[] = array(
'userPHID' => $user_phid,
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
@@ -1463,8 +1463,7 @@
if ($user_phid) {
$map = $type->newValueForUsers($key, array($this));
if (array_key_exists($user_phid, $map)) {
- $usable_value = $map[$user_phid];
- $raw_value = $type->getValueForStorage($usable_value);
+ $raw_value = $map[$user_phid];
$usable_value = $type->getValueFromStorage($raw_value);
$this->rawCacheData[$key] = $raw_value;

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 2, 6:00 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717787
Default Alt Text
D16043.id38609.diff (4 KB)

Event Timeline