Page MenuHomePhabricator

D7682.id25918.diff
No OneTemporary

D7682.id25918.diff

diff --git a/keyserver/src/updaters/account-updaters.js b/keyserver/src/updaters/account-updaters.js
--- a/keyserver/src/updaters/account-updaters.js
+++ b/keyserver/src/updaters/account-updaters.js
@@ -183,10 +183,7 @@
const selectResult = resultSet.pop();
const knownUserInfos: UserInfos = await fetchKnownUserInfos(viewer);
- const userUpdatesPromise = createUserAvatarUpdates(
- knownUserInfos,
- viewer.userID,
- );
+ const userUpdatesPromise = createUserAvatarUpdates(knownUserInfos, viewer);
handleAsyncPromise(userUpdatesPromise);
if (request.type === 'remove') {
@@ -210,22 +207,33 @@
async function createUserAvatarUpdates(
knownUserInfos: UserInfos,
- updatedUserID: string,
+ viewer: Viewer,
): Promise<void> {
- const usersToUpdate: $ReadOnlyArray<UserInfo> = values(knownUserInfos).filter(
- (user: UserInfo): boolean => user.id !== updatedUserID,
- );
const time = Date.now();
- const updateDatas: $ReadOnlyArray<UpdateData> = usersToUpdate.map(
+ const peersToUpdate: $ReadOnlyArray<UserInfo> = values(knownUserInfos).filter(
+ (user: UserInfo): boolean => user.id !== viewer.userID,
+ );
+ const peerUpdateDatas: $ReadOnlyArray<UpdateData> = peersToUpdate.map(
(user: UserInfo): UpdateData => ({
type: updateTypes.UPDATE_USER,
userID: user.id,
time,
- updatedUserID: updatedUserID,
+ updatedUserID: viewer.userID,
}),
);
+ const peerUpdatesPromise = createUpdates(peerUpdateDatas);
+
+ const currentUserUpdateData: UpdateData = {
+ type: updateTypes.UPDATE_CURRENT_USER,
+ userID: viewer.userID,
+ time,
+ };
+ const currentUserUpdatePromise = createUpdates([currentUserUpdateData], {
+ viewer,
+ updatesForCurrentSession: 'return',
+ });
- await createUpdates(updateDatas);
+ await Promise.all([peerUpdatesPromise, currentUserUpdatePromise]);
}
export {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 1:48 PM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597165
Default Alt Text
D7682.id25918.diff (1 KB)

Event Timeline