Skip to content

Commit

Permalink
[keyserver] Get rid of code for updating client ThreadStore when upgr…
Browse files Browse the repository at this point in the history
…ade to codeVersion 70 occurs

Summary:
See the first diff in the stack. We're no longer expecting to see such an old `codeVersion`, so I'm going to delete this code.

This is admittedly slightly more risky than some of the other diffs in the stack, because this doesn't just break the USE of such an old `codeVersion`, but rather breaks the upgrade FROM such an old `codeVersion`.

However, I think it's safe because we don't currently have any logged-in sessions with such an old `codeVersion`, and we prevent log in / registration with such an old `codeVersion` in the parent diff. So we don't expect such an upgrade to occur.

Depends on D8503

Test Plan: I tested this whole stack together by playing around with the web app and making sure thread mutation endpoints seemed to work correctly

Reviewers: michal, kamil

Reviewed By: kamil

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8504
  • Loading branch information
Ashoat committed Jul 17, 2023
1 parent 7aadfce commit 7aa757e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
9 changes: 0 additions & 9 deletions keyserver/src/session/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import invariant from 'invariant';
import bcrypt from 'twin-bcrypt';
import url from 'url';

import { hasMinCodeVersion } from 'lib/shared/version-utils.js';
import type { Shape } from 'lib/types/core.js';
import type { SignedIdentityKeysBlob } from 'lib/types/crypto-types.js';
import { isWebPlatform } from 'lib/types/device-types.js';
Expand Down Expand Up @@ -35,7 +34,6 @@ import { dbQuery, SQL } from '../database/database.js';
import { deleteCookie } from '../deleters/cookie-deleters.js';
import { handleAsyncPromise } from '../responders/handlers.js';
import { clearDeviceToken } from '../updaters/device-token-updaters.js';
import { updateThreadMembers } from '../updaters/thread-updaters.js';
import { assertSecureRequest } from '../utils/security-utils.js';
import {
type AppURLFacts,
Expand Down Expand Up @@ -862,13 +860,6 @@ async function setCookiePlatformDetails(
viewer: Viewer,
platformDetails: PlatformDetails,
): Promise<void> {
if (
hasMinCodeVersion(platformDetails, { native: 70 }) &&
!hasMinCodeVersion(viewer.platformDetails, { native: 70 })
) {
await updateThreadMembers(viewer);
}

viewer.setPlatformDetails(platformDetails);
const { platform, ...versions } = platformDetails;
const versionsString =
Expand Down
22 changes: 0 additions & 22 deletions keyserver/src/updaters/thread-updaters.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,27 +948,6 @@ async function joinThread(
return response;
}

async function updateThreadMembers(viewer: Viewer) {
const { threadInfos } = await fetchThreadInfos(
viewer,
SQL`t.parent_thread_id IS NOT NULL `,
);

const updateDatas = [];
const time = Date.now();
for (const threadID in threadInfos) {
updateDatas.push({
type: updateTypes.UPDATE_THREAD,
userID: viewer.id,
time,
threadID: threadID,
targetSession: viewer.session,
});
}

await createUpdates(updateDatas);
}

async function toggleMessagePinForThread(
viewer: Viewer,
request: ToggleMessagePinRequest,
Expand Down Expand Up @@ -1058,6 +1037,5 @@ export {
leaveThread,
updateThread,
joinThread,
updateThreadMembers,
toggleMessagePinForThread,
};

0 comments on commit 7aa757e

Please sign in to comment.