Page MenuHomePhabricator

D7162.diff
No OneTemporary

D7162.diff

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

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)

Event Timeline