Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3541809
D8510.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
D8510.diff
View Options
diff --git a/keyserver/src/socket/session-utils.js b/keyserver/src/socket/session-utils.js
--- a/keyserver/src/socket/session-utils.js
+++ b/keyserver/src/socket/session-utils.js
@@ -5,12 +5,9 @@
import type { TUnion } from 'tcomb';
import {
- usersInRawEntryInfos,
serverEntryInfo,
serverEntryInfosObject,
} from 'lib/shared/entry-utils.js';
-import { usersInThreadInfo } from 'lib/shared/thread-utils.js';
-import { hasMinCodeVersion } from 'lib/shared/version-utils.js';
import type { UpdateActivityResult } from 'lib/types/activity-types.js';
import type { IdentityKeysBlob } from 'lib/types/crypto-types.js';
import { isDeviceType } from 'lib/types/device-types.js';
@@ -54,7 +51,6 @@
import { fetchThreadInfos } from '../fetchers/thread-fetchers.js';
import {
fetchCurrentUserInfo,
- fetchUserInfos,
fetchKnownUserInfos,
} from '../fetchers/user-fetchers.js';
import { activityUpdatesInputValidator } from '../responders/activity-responders.js';
@@ -397,10 +393,6 @@
status: StateCheckStatus,
calendarQuery: CalendarQuery,
): Promise<StateCheckResult> {
- const shouldCheckUserInfos = hasMinCodeVersion(viewer.platformDetails, {
- native: 59,
- });
-
if (status.status === 'state_validated') {
return { sessionUpdate: { lastValidated: Date.now() } };
} else if (status.status === 'state_check') {
@@ -408,25 +400,17 @@
threadsResult: fetchThreadInfos(viewer),
entriesResult: fetchEntryInfos(viewer, [calendarQuery]),
currentUserInfo: fetchCurrentUserInfo(viewer),
- userInfosResult: undefined,
+ userInfosResult: fetchKnownUserInfos(viewer),
};
- if (shouldCheckUserInfos) {
- promises.userInfosResult = fetchKnownUserInfos(viewer);
- }
const fetchedData = await promiseAll(promises);
- let hashesToCheck = {
+ const hashesToCheck = {
threadInfos: hash(fetchedData.threadsResult.threadInfos),
entryInfos: hash(
serverEntryInfosObject(fetchedData.entriesResult.rawEntryInfos),
),
currentUserInfo: hash(fetchedData.currentUserInfo),
+ userInfos: hash(fetchedData.userInfosResult),
};
- if (shouldCheckUserInfos) {
- hashesToCheck = {
- ...hashesToCheck,
- userInfos: hash(fetchedData.userInfosResult),
- };
- }
const checkStateRequest = {
type: serverRequestTypes.CHECK_STATE,
hashesToCheck,
@@ -578,36 +562,6 @@
}
}
- if (!shouldCheckUserInfos) {
- const userIDs = new Set();
- if (stateChanges.rawThreadInfos) {
- for (const threadInfo of stateChanges.rawThreadInfos) {
- for (const userID of usersInThreadInfo(threadInfo)) {
- userIDs.add(userID);
- }
- }
- }
- if (stateChanges.rawEntryInfos) {
- for (const userID of usersInRawEntryInfos(stateChanges.rawEntryInfos)) {
- userIDs.add(userID);
- }
- }
-
- const userInfos = [];
- if (userIDs.size > 0) {
- const fetchedUserInfos = await fetchUserInfos([...userIDs]);
- for (const userID in fetchedUserInfos) {
- const userInfo = fetchedUserInfos[userID];
- if (userInfo && userInfo.username) {
- const { id, username } = userInfo;
- userInfos.push({ id, username });
- }
- }
- }
- if (userInfos.length > 0) {
- stateChanges.userInfos = userInfos;
- }
- }
const checkStateRequest = {
type: serverRequestTypes.CHECK_STATE,
hashesToCheck,
diff --git a/lib/shared/entry-utils.js b/lib/shared/entry-utils.js
--- a/lib/shared/entry-utils.js
+++ b/lib/shared/entry-utils.js
@@ -113,16 +113,6 @@
return filtered ? filteredRawEntryInfos : rawEntryInfos;
}
-function usersInRawEntryInfos(
- entryInfos: $ReadOnlyArray<RawEntryInfo>,
-): string[] {
- const userIDs = new Set();
- for (const entryInfo of entryInfos) {
- userIDs.add(entryInfo.creatorID);
- }
- return [...userIDs];
-}
-
// Note: fetchEntriesForSession expects that all of the CalendarQueries in the
// resultant array either filter deleted entries or don't
function calendarQueryDifference(
@@ -257,7 +247,6 @@
rawEntryInfoWithinActiveRange,
rawEntryInfoWithinCalendarQuery,
filterRawEntryInfosByCalendarQuery,
- usersInRawEntryInfos,
calendarQueryDifference,
serverEntryInfo,
serverEntryInfosObject,
diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -963,14 +963,6 @@
'Only visible to its members and admins of ancestor channels.',
};
-function usersInThreadInfo(threadInfo: RawThreadInfo | ThreadInfo): string[] {
- const userIDs = new Set();
- for (const member of threadInfo.members) {
- userIDs.add(member.id);
- }
- return [...userIDs];
-}
-
function memberIsAdmin(
memberInfo: RelativeMemberInfo | MemberInfo,
threadInfo: ThreadInfo | RawThreadInfo,
@@ -1575,7 +1567,6 @@
threadUIName,
threadInfoFromRawThreadInfo,
threadTypeDescriptions,
- usersInThreadInfo,
memberIsAdmin,
memberHasAdminPowers,
roleIsAdminRole,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 7:14 AM (10 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2711671
Default Alt Text
D8510.diff (4 KB)
Attached To
Mode
D8510: [keyserver][lib] Simplify state check mechanism following deprecation of old codeVersions
Attached
Detach File
Event Timeline
Log In to Comment