Page MenuHomePhabricator

D7054.id23888.diff
No OneTemporary

D7054.id23888.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
@@ -200,7 +200,7 @@
viewer: Viewer,
): Promise<OldLoggedInUserInfo | LoggedInUserInfo> {
const userQuery = SQL`
- SELECT id, username
+ SELECT id, username, avatar
FROM users
WHERE id = ${viewer.userID}
`;
@@ -228,7 +228,7 @@
}
const id = userRow.id.toString();
- const { username } = userRow;
+ const { username, avatar } = userRow;
if (stillExpectsEmailFields) {
return {
@@ -241,16 +241,26 @@
const featureGateSettings = !hasMinCodeVersion(viewer.platformDetails, 1000);
+ let loggedInUserInfo: LoggedInUserInfo = {
+ id,
+ username,
+ };
+
+ if (avatar) {
+ loggedInUserInfo = { ...loggedInUserInfo, avatar };
+ }
+
if (featureGateSettings) {
- return { id, username };
+ return loggedInUserInfo;
}
const settings = settingsResult.reduce((prev, curr) => {
prev[curr.name] = curr.data;
return prev;
}, {});
+ loggedInUserInfo = { ...loggedInUserInfo, settings };
- return { id, username, settings };
+ return loggedInUserInfo;
}
async function fetchAllUserIDs(): Promise<string[]> {
diff --git a/lib/types/user-types.js b/lib/types/user-types.js
--- a/lib/types/user-types.js
+++ b/lib/types/user-types.js
@@ -1,6 +1,7 @@
// @flow
import type { DefaultNotificationPayload } from './account-types.js';
+import type { AvatarDBContent } from './avatar-types';
import type { UserRelationshipStatus } from './relationship-types.js';
import type { UserInconsistencyReportCreationRequest } from './report-types.js';
@@ -48,6 +49,7 @@
export type LoggedInUserInfo = {
+id: string,
+username: string,
+ +avatar?: AvatarDBContent,
+settings?: DefaultNotificationPayload,
};

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 2:41 PM (22 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580127
Default Alt Text
D7054.id23888.diff (1 KB)

Event Timeline