Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3570136
D8649.id29160.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8649.id29160.diff
View Options
diff --git a/lib/selectors/socket-selectors.js b/lib/selectors/socket-selectors.js
--- a/lib/selectors/socket-selectors.js
+++ b/lib/selectors/socket-selectors.js
@@ -74,22 +74,6 @@
currentUserInfo: ?CurrentUserInfo,
calendarQuery: (calendarActive: boolean) => CalendarQuery,
) => {
- threadInfos = convertClientIDsToServerIDs(
- ashoatKeyserverID,
- t.dict(tID, rawThreadInfoValidator),
- threadInfos,
- );
- userInfos = convertClientIDsToServerIDs(
- ashoatKeyserverID,
- userInfosValidator,
- userInfos,
- );
- currentUserInfo = convertClientIDsToServerIDs(
- ashoatKeyserverID,
- t.maybe(currentUserInfoValidator),
- currentUserInfo,
- );
-
return async (
calendarActive: boolean,
oneTimeKeyGenerator: ?OneTimeKeyGenerator,
@@ -116,42 +100,60 @@
platformDetails: getConfig().platformDetails,
});
} else if (serverRequest.type === serverRequestTypes.CHECK_STATE) {
- let filteredEntryInfos = filterRawEntryInfosByCalendarQuery(
+ const filteredEntryInfos = filterRawEntryInfosByCalendarQuery(
serverEntryInfosObject(values(entryInfos)),
calendarQuery(calendarActive),
);
- filteredEntryInfos = convertClientIDsToServerIDs(
+ const convertedEntryInfos = convertClientIDsToServerIDs(
ashoatKeyserverID,
t.dict(tID, rawEntryInfoValidator),
filteredEntryInfos,
);
+ const convertedThreadInfos = convertClientIDsToServerIDs(
+ ashoatKeyserverID,
+ t.dict(tID, rawThreadInfoValidator),
+ threadInfos,
+ );
+
+ const convertedUserInfos = convertClientIDsToServerIDs(
+ ashoatKeyserverID,
+ userInfosValidator,
+ userInfos,
+ );
+
+ const convertedCurrentUserInfo = convertClientIDsToServerIDs(
+ ashoatKeyserverID,
+ t.maybe(currentUserInfoValidator),
+ currentUserInfo,
+ );
+
const hashResults = {};
for (const key in serverRequest.hashesToCheck) {
const expectedHashValue = serverRequest.hashesToCheck[key];
let hashValue;
if (key === 'threadInfos') {
- hashValue = hash(threadInfos);
+ hashValue = hash(convertedThreadInfos);
} else if (key === 'entryInfos') {
- hashValue = hash(filteredEntryInfos);
+ hashValue = hash(convertedEntryInfos);
} else if (key === 'userInfos') {
- hashValue = hash(userInfos);
+ hashValue = hash(convertedUserInfos);
} else if (key === 'currentUserInfo') {
- hashValue = hash(currentUserInfo);
+ hashValue = hash(convertedCurrentUserInfo);
} else if (key.startsWith('threadInfo|')) {
const [, threadID] = key.split('|');
- hashValue = hash(threadInfos[threadID]);
+ hashValue = hash(convertedThreadInfos[threadID]);
} else if (key.startsWith('entryInfo|')) {
const [, entryID] = key.split('|');
- let rawEntryInfo = filteredEntryInfos[entryID];
+ let rawEntryInfo = convertedEntryInfos[entryID];
if (rawEntryInfo) {
rawEntryInfo = serverEntryInfo(rawEntryInfo);
}
hashValue = hash(rawEntryInfo);
} else if (key.startsWith('userInfo|')) {
const [, userID] = key.split('|');
- hashValue = hash(userInfos[userID]);
+ hashValue = hash(convertedUserInfos[userID]);
} else {
continue;
}
@@ -160,7 +162,7 @@
const { failUnmentioned } = serverRequest;
if (failUnmentioned && failUnmentioned.threadInfos) {
- for (const threadID in threadInfos) {
+ for (const threadID in convertedThreadInfos) {
const key = `threadInfo|${threadID}`;
const hashResult = hashResults[key];
if (hashResult === null || hashResult === undefined) {
@@ -169,7 +171,7 @@
}
}
if (failUnmentioned && failUnmentioned.entryInfos) {
- for (const entryID in filteredEntryInfos) {
+ for (const entryID in convertedEntryInfos) {
const key = `entryInfo|${entryID}`;
const hashResult = hashResults[key];
if (hashResult === null || hashResult === undefined) {
@@ -178,7 +180,7 @@
}
}
if (failUnmentioned && failUnmentioned.userInfos) {
- for (const userID in userInfos) {
+ for (const userID in convertedUserInfos) {
const key = `userInfo|${userID}`;
const hashResult = hashResults[key];
if (hashResult === null || hashResult === undefined) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 29, 3:54 AM (8 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2726658
Default Alt Text
D8649.id29160.diff (4 KB)
Attached To
Mode
D8649: [lib] Run conversion only on state check
Attached
Detach File
Event Timeline
Log In to Comment