diff --git a/keyserver/src/shared/state-sync/entries-state-sync-spec.js b/keyserver/src/shared/state-sync/entries-state-sync-spec.js --- a/keyserver/src/shared/state-sync/entries-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/entries-state-sync-spec.js @@ -19,14 +19,11 @@ RawEntryInfos, $ReadOnlyArray, > = Object.freeze({ - async fetch( - viewer: Viewer, - query: $ReadOnlyArray, - ids?: $ReadOnlySet, - ) { + async fetch(viewer: Viewer, ids?: $ReadOnlySet) { if (ids) { return fetchEntryInfosByID(viewer, ids); } + const query = [viewer.calendarQuery]; const entriesResult = await fetchEntryInfos(viewer, query); return serverEntryInfosObject(entriesResult.rawEntryInfos); }, diff --git a/keyserver/src/shared/state-sync/state-sync-spec.js b/keyserver/src/shared/state-sync/state-sync-spec.js --- a/keyserver/src/shared/state-sync/state-sync-spec.js +++ b/keyserver/src/shared/state-sync/state-sync-spec.js @@ -6,11 +6,7 @@ import type { Viewer } from '../../session/viewer.js'; export type ServerStateSyncSpec = { - +fetch: ( - viewer: Viewer, - calendarQuery: $ReadOnlyArray, - ids?: $ReadOnlySet, - ) => Promise, + +fetch: (viewer: Viewer, ids?: $ReadOnlySet) => Promise, +fetchFullSocketSyncPayload: ( viewer: Viewer, calendarQuery: $ReadOnlyArray, diff --git a/keyserver/src/shared/state-sync/threads-state-sync-spec.js b/keyserver/src/shared/state-sync/threads-state-sync-spec.js --- a/keyserver/src/shared/state-sync/threads-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/threads-state-sync-spec.js @@ -1,7 +1,6 @@ // @flow import { threadsStateSyncSpec as libSpec } from 'lib/shared/state-sync/threads-state-sync-spec.js'; -import type { CalendarQuery } from 'lib/types/entry-types.js'; import type { RawThreadInfos } from 'lib/types/thread-types.js'; import type { ServerStateSyncSpec } from './state-sync-spec.js'; @@ -12,11 +11,7 @@ RawThreadInfos, RawThreadInfos, > = Object.freeze({ - async fetch( - viewer: Viewer, - query: $ReadOnlyArray, - ids?: $ReadOnlySet, - ) { + async fetch(viewer: Viewer, ids?: $ReadOnlySet) { const filter = ids ? { threadIDs: ids } : undefined; const result = await fetchThreadInfos(viewer, filter); return result.threadInfos; diff --git a/keyserver/src/shared/state-sync/users-state-sync-spec.js b/keyserver/src/shared/state-sync/users-state-sync-spec.js --- a/keyserver/src/shared/state-sync/users-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/users-state-sync-spec.js @@ -1,7 +1,6 @@ // @flow import { usersStateSyncSpec as libSpec } from 'lib/shared/state-sync/users-state-sync-spec.js'; -import type { CalendarQuery } from 'lib/types/entry-types.js'; import type { UserInfos, UserInfo } from 'lib/types/user-types.js'; import { values } from 'lib/utils/objects.js'; @@ -14,11 +13,7 @@ $ReadOnlyArray, UserInfo, > = Object.freeze({ - fetch( - viewer: Viewer, - query: $ReadOnlyArray, - ids?: $ReadOnlySet, - ) { + fetch(viewer: Viewer, ids?: $ReadOnlySet) { if (ids) { return fetchKnownUserInfos(viewer, [...ids]); } 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 @@ -378,9 +378,7 @@ async function checkState( viewer: Viewer, status: StateCheckStatus, - calendarQuery: CalendarQuery, ): Promise { - const query = [calendarQuery]; if (status.status === 'state_validated') { return { sessionUpdate: { lastValidated: Date.now() } }; } else if (status.status === 'state_check') { @@ -388,7 +386,7 @@ values(serverStateSyncSpecs).map(spec => [ spec.hashKey, (async () => { - const data = await spec.fetch(viewer, query); + const data = await spec.fetch(viewer); return hash(data); })(), ]), @@ -424,11 +422,10 @@ const fetchPromises = {}; for (const spec of values(serverStateSyncSpecs)) { if (shouldFetchAll[spec.hashKey]) { - fetchPromises[spec.hashKey] = spec.fetch(viewer, query); + fetchPromises[spec.hashKey] = spec.fetch(viewer); } else if (idsToFetch[spec.innerHashSpec?.hashKey]?.size > 0) { fetchPromises[spec.hashKey] = spec.fetch( viewer, - query, idsToFetch[spec.innerHashSpec?.hashKey], ); } diff --git a/keyserver/src/socket/socket.js b/keyserver/src/socket/socket.js --- a/keyserver/src/socket/socket.js +++ b/keyserver/src/socket/socket.js @@ -602,7 +602,6 @@ const { sessionUpdate, checkStateRequest } = await checkState( viewer, stateCheckStatus, - viewer.calendarQuery, ); if (sessionUpdate) { await commitSessionUpdate(viewer, sessionUpdate); @@ -825,11 +824,9 @@ const { viewer } = this; invariant(viewer, 'should be set'); - const { checkStateRequest } = await checkState( - viewer, - { status: 'state_check' }, - viewer.calendarQuery, - ); + const { checkStateRequest } = await checkState(viewer, { + status: 'state_check', + }); invariant(checkStateRequest, 'should be set'); this.sendMessage({