Page MenuHomePhabricator

D5462.diff
No OneTemporary

D5462.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
@@ -24,7 +24,7 @@
import type { Viewer } from '../session/viewer.js';
async function fetchUserInfos(
- userIDs: string[],
+ userIDs: $ReadOnlyArray<string>,
): Promise<{ [id: string]: GlobalUserInfo }> {
if (userIDs.length <= 0) {
return {};
diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -39,6 +39,7 @@
import {
fetchCurrentUserInfo,
fetchKnownUserInfos,
+ fetchUserInfos,
} from '../fetchers/user-fetchers.js';
import { setNewSession } from '../session/cookies.js';
import { Viewer } from '../session/viewer.js';
@@ -143,6 +144,28 @@
throw new ServerError(e.message);
}
+ let navInfoUserInfoPromise;
+ if (
+ viewer.loggedIn &&
+ initialNavInfo.tab === 'chat' &&
+ initialNavInfo.chatMode === 'create' &&
+ initialNavInfo.selectedUserList &&
+ initialNavInfo.selectedUserList.length > 0
+ ) {
+ const userIDs = initialNavInfo.selectedUserList;
+ navInfoUserInfoPromise = (async () => {
+ const userInfos = {};
+ const fetchedUserInfos = await fetchUserInfos(userIDs);
+ for (const userID in fetchedUserInfos) {
+ const userInfo = fetchedUserInfos[userID];
+ if (userInfo.username) {
+ userInfos[userID] = userInfo;
+ }
+ }
+ return userInfos;
+ })();
+ }
+
const calendarQuery = {
startDate: initialNavInfo.startDate,
endDate: initialNavInfo.endDate,
@@ -160,7 +183,7 @@
);
const entryInfoPromise = fetchEntryInfos(viewer, [calendarQuery]);
const currentUserInfoPromise = fetchCurrentUserInfo(viewer);
- const userInfoPromise = fetchKnownUserInfos(viewer);
+ const knownUserInfoPromise = fetchKnownUserInfos(viewer);
const sessionIDPromise = (async () => {
if (viewer.loggedIn) {
@@ -221,12 +244,16 @@
};
})();
const userStorePromise = (async () => {
- const [userInfos, hasNotAcknowledgedPolicies] = await Promise.all([
- userInfoPromise,
- hasNotAcknowledgedPoliciesPromise,
- ]);
+ const [knownUserInfos, hasNotAcknowledgedPolicies, navInfoUserInfos] =
+ await Promise.all([
+ knownUserInfoPromise,
+ hasNotAcknowledgedPoliciesPromise,
+ navInfoUserInfoPromise,
+ ]);
return {
- userInfos: hasNotAcknowledgedPolicies ? {} : userInfos,
+ userInfos: hasNotAcknowledgedPolicies
+ ? {}
+ : { ...navInfoUserInfos, ...knownUserInfos },
inconsistencyReports: [],
};
})();

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 5:32 AM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2599779
Default Alt Text
D5462.diff (2 KB)

Event Timeline