Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3518576
D9657.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9657.diff
View Options
diff --git a/keyserver/src/creators/update-creator.js b/keyserver/src/creators/update-creator.js
--- a/keyserver/src/creators/update-creator.js
+++ b/keyserver/src/creators/update-creator.js
@@ -399,6 +399,9 @@
.map(({ detailedThreadID }) => detailedThreadID)
.filter(Boolean),
);
+ const userIDsToFetch = new Set(
+ entitiesToFetch.map(({ userID }) => userID).filter(Boolean),
+ );
const promises = {};
@@ -458,12 +461,17 @@
})();
}
+ if (userIDsToFetch.size > 0) {
+ promises.userInfosResult = fetchKnownUserInfos(viewer, [...userIDsToFetch]);
+ }
+
const {
threadResult,
messageInfosResult,
calendarResult,
entryInfosResult,
currentUserInfoResult,
+ userInfosResult,
} = await promiseAll(promises);
let threadInfos = {};
@@ -479,6 +487,7 @@
calendarResult,
entryInfosResult,
currentUserInfoResult,
+ userInfosResult,
});
}
@@ -487,7 +496,7 @@
rawUpdateInfos: $ReadOnlyArray<RawUpdateInfo>,
rawData: UpdateInfosRawData,
): Promise<FetchUpdatesResult> {
- const { messageInfosResult, calendarResult } = rawData;
+ const { messageInfosResult, calendarResult, userInfosResult } = rawData;
const rawEntryInfosByThreadID = {};
for (const entryInfo of calendarResult?.rawEntryInfos ?? []) {
@@ -505,13 +514,6 @@
rawMessageInfosByThreadID[messageInfo.threadID].push(messageInfo);
}
- const userIDsToFetch = new Set(
- rawUpdateInfos
- .map(update =>
- update.type === updateTypes.UPDATE_USER ? update.updatedUserID : null,
- )
- .filter(Boolean),
- );
const params = {
data: rawData,
rawEntryInfosByThreadID,
@@ -523,11 +525,6 @@
)
.filter(Boolean);
- let userInfos = {};
- if (userIDsToFetch.size > 0) {
- userInfos = await fetchKnownUserInfos(viewer, [...userIDsToFetch]);
- }
-
updateInfos.sort(sortFunction);
// Now we'll attempt to merge UpdateInfos so that we only have one per key
@@ -573,7 +570,7 @@
}
mergedUpdates.sort(sortFunction);
- return { updateInfos: mergedUpdates, userInfos };
+ return { updateInfos: mergedUpdates, userInfos: userInfosResult ?? {} };
}
type PublishInfo = {
diff --git a/lib/shared/updates/update-spec.js b/lib/shared/updates/update-spec.js
--- a/lib/shared/updates/update-spec.js
+++ b/lib/shared/updates/update-spec.js
@@ -29,6 +29,7 @@
+calendarResult: ?FetchEntryInfosBase,
+entryInfosResult: ?RawEntryInfos,
+currentUserInfoResult: LoggedInUserInfo,
+ +userInfosResult: ?UserInfos,
};
export type UpdateInfoFromRawInfoParams = {
@@ -78,6 +79,7 @@
+detailedThreadID?: string,
+entryID?: string,
+currentUser?: boolean,
+ +userID?: string,
},
+updateInfoFromRawInfo: (
info: RawInfo,
diff --git a/lib/shared/updates/update-user-spec.js b/lib/shared/updates/update-user-spec.js
--- a/lib/shared/updates/update-user-spec.js
+++ b/lib/shared/updates/update-user-spec.js
@@ -22,6 +22,11 @@
updatedUserID: content.updatedUserID,
};
},
+ entitiesToFetch(info: UserRawUpdateInfo) {
+ return {
+ userID: info.updatedUserID,
+ };
+ },
updateContentForServerDB(data: UserUpdateData) {
const { updatedUserID } = data;
return JSON.stringify({ updatedUserID });
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 8:25 PM (18 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2696244
Default Alt Text
D9657.diff (3 KB)
Attached To
Mode
D9657: [keyserver] Fetch user infos together with other data
Attached
Detach File
Event Timeline
Log In to Comment