Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3365766
D7162.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D7162.diff
View Options
diff --git a/keyserver/src/fetchers/user-fetchers.js b/keyserver/src/fetchers/user-fetchers.js
--- a/keyserver/src/fetchers/user-fetchers.js
+++ b/keyserver/src/fetchers/user-fetchers.js
@@ -1,6 +1,7 @@
// @flow
import { hasMinCodeVersion } from 'lib/shared/version-utils.js';
+import type { AvatarDBContent, ClientAvatar } from 'lib/types/avatar-types.js';
import {
undirectedStatus,
directedStatus,
@@ -31,18 +32,33 @@
}
const query = SQL`
- SELECT id, username FROM users WHERE id IN (${userIDs})
+ SELECT id, username, avatar
+ FROM users
+ WHERE id IN (${userIDs})
`;
const [result] = await dbQuery(query);
const userInfos = {};
for (const row of result) {
const id = row.id.toString();
- userInfos[id] = {
- id,
- username: row.username,
- };
+ const avatar: ?AvatarDBContent = row.avatar ? JSON.parse(row.avatar) : null;
+
+ // TODO: Handle construction of `ClientImageAvatar` when `type === 'image'`
+ const clientAvatar: ?ClientAvatar =
+ avatar && avatar.type !== 'image' ? avatar : null;
+
+ userInfos[id] = avatar
+ ? {
+ id,
+ username: row.username,
+ avatar: clientAvatar,
+ }
+ : {
+ id,
+ username: row.username,
+ };
}
+
for (const userID of userIDs) {
if (!userInfos[userID]) {
userInfos[userID] = {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 7:37 AM (22 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2583903
Default Alt Text
D7162.diff (1 KB)
Attached To
Mode
D7162: [keyserver] Update `fetchUserInfos` to include `avatar`s in `GlobalUserInfo`s
Attached
Detach File
Event Timeline
Log In to Comment