From 76b7c2192f82b2243badfd780e621235dd2508e5 Mon Sep 17 00:00:00 2001 From: William Grant Date: Tue, 26 Mar 2024 14:39:18 +1100 Subject: [PATCH] feat: depracate getLastProfileUpdateTimestamp since new user config has been on for a few months --- ts/receiver/configMessage.ts | 34 +--------------------------------- ts/util/storage.ts | 4 ---- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index dd0b26087..465a98ac2 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -35,12 +35,7 @@ import { assertUnreachable } from '../types/sqlSharedTypes'; import { BlockedNumberController } from '../util'; import { Registration } from '../util/registration'; import { ReleasedFeatures } from '../util/releaseFeature'; -import { - Storage, - getLastProfileUpdateTimestamp, - isSignInByLinking, - setLastProfileUpdateTimestamp, -} from '../util/storage'; +import { Storage, isSignInByLinking, setLastProfileUpdateTimestamp } from '../util/storage'; // eslint-disable-next-line import/no-unresolved import { ConfigWrapperObjectTypes } from '../webworker/workers/browser/libsession_worker_functions'; @@ -946,32 +941,6 @@ async function updateOurProfileLegacyOrViaLibSession({ } } -async function handleOurProfileUpdateLegacy( - sentAt: number | Long, - configMessage: SignalService.ConfigurationMessage -) { - const userConfigLibsession = await ReleasedFeatures.checkIsUserConfigFeatureReleased(); - // we want to allow if we are not registered, as we might need to fetch an old config message (can be removed once we released for a weeks the libsession util) - if (userConfigLibsession && !isSignInByLinking()) { - return; - } - const latestProfileUpdateTimestamp = getLastProfileUpdateTimestamp(); - if (!latestProfileUpdateTimestamp || sentAt > latestProfileUpdateTimestamp) { - window?.log?.info( - `Handling our profileUdpate ourLastUpdate:${latestProfileUpdateTimestamp}, envelope sent at: ${sentAt}` - ); - const { profileKey, profilePicture, displayName } = configMessage; - - await updateOurProfileLegacyOrViaLibSession({ - sentAt: toNumber(sentAt), - displayName, - profileUrl: profilePicture, - profileKey, - priority: null, // passing null to say do not set the priority, as we do not get one from the legacy config message - }); - } -} - async function handleGroupsAndContactsFromConfigMessageLegacy( envelope: EnvelopePlus, configMessage: SignalService.ConfigurationMessage @@ -1141,7 +1110,6 @@ async function handleConfigurationMessageLegacy( return; } - await handleOurProfileUpdateLegacy(envelope.timestamp, configurationMessage); await handleGroupsAndContactsFromConfigMessageLegacy(envelope, configurationMessage); await removeFromCache(envelope); } diff --git a/ts/util/storage.ts b/ts/util/storage.ts index ba229323c..dbf0e2507 100644 --- a/ts/util/storage.ts +++ b/ts/util/storage.ts @@ -129,10 +129,6 @@ export async function setSignWithRecoveryPhrase(isRecoveryPhraseUsed: boolean) { await put('is_sign_in_recovery_phrase', isRecoveryPhraseUsed); } -export function getLastProfileUpdateTimestamp() { - return get('last_profile_update_timestamp'); -} - export async function setLastProfileUpdateTimestamp(lastUpdateTimestamp: number) { if (await ReleasedFeatures.checkIsUserConfigFeatureReleased()) { return;