fix: linking allows legacy config message if one is found

pull/2756/head
Audric Ackermann 1 year ago
parent 37639077a1
commit 6ac4dd8db5

@ -41,6 +41,7 @@ const ConversationListItemContextMenu = (props: PropsContextConversationItem) =>
if (isSearchingMode) {
return null;
}
return (
<SessionContextMenuContainer>
<Menu id={triggerId} animation={animation.fade}>

@ -35,6 +35,7 @@ import { ReleasedFeatures } from '../util/releaseFeature';
import {
Storage,
getLastProfileUpdateTimestamp,
isSignInByLinking,
setLastProfileUpdateTimestamp,
} from '../util/storage';
import { ConfigWrapperObjectTypes } from '../webworker/workers/browser/libsession_worker_functions';
@ -767,7 +768,7 @@ async function handleOurProfileUpdateLegacy(
) {
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 && Registration.isDone()) {
if (userConfigLibsession && !isSignInByLinking()) {
return;
}
const latestProfileUpdateTimestamp = getLastProfileUpdateTimestamp();
@ -978,7 +979,7 @@ async function handleConfigurationMessageLegacy(
// the process of those messages is always done after the process of the shared config messages, so that's only a fallback.
const userConfigLibsession = await ReleasedFeatures.checkIsUserConfigFeatureReleased();
if (userConfigLibsession && Registration.isDone()) {
if (userConfigLibsession && !isSignInByLinking()) {
window?.log?.info(
'useSharedUtilForUserConfig is set, not handling config messages with "handleConfigurationMessageLegacy()"'
);
@ -987,7 +988,7 @@ async function handleConfigurationMessageLegacy(
return;
}
window?.log?.info('Handling configuration message');
window?.log?.info('Handling legacy configuration message');
const ourPubkey = UserUtils.getOurPubKeyStrFromCache();
if (!ourPubkey) {
return;

@ -189,9 +189,11 @@ export async function TEST_fetchFromSeedWithRetriesAndWriteToDb() {
return;
}
const start = Date.now();
try {
randomSnodePool = await SeedNodeAPI.fetchSnodePoolFromSeedNodeWithRetries(seedNodes);
await Data.updateSnodePoolOnDb(JSON.stringify(randomSnodePool));
window.log.info(`fetchSnodePoolFromSeedNodeWithRetries took ${Date.now() - start}ms`);
OnionPaths.resetPathFailureCount();
Onions.resetSnodeFailureCount();

@ -431,7 +431,9 @@ export async function getGuardNodeOrSelectNewOnes() {
// If guard nodes is still empty (the old nodes are now invalid), select new ones:
if (guardNodes.length < desiredGuardCount) {
// if an error is thrown, the caller must take care of it.
const start = Date.now();
guardNodes = await OnionPaths.selectGuardNodes();
window.log.info(`OnionPaths.selectGuardNodes took ${Date.now() - start}ms`);
}
}

@ -176,8 +176,13 @@ async function createAccount(identityKeyPair: SessionKeyPair) {
await setLocalPubKey(pubKeyString);
}
/**
*
* @param ourPubkey the pubkey recovered from the seed
* @param displayName the display name entered by the user, if any. This is not a display name found from a config message in the network.
*/
async function registrationDone(ourPubkey: string, displayName: string) {
window?.log?.info('registration done');
window?.log?.info(`registration done with user provided displayName "${displayName}"`);
// initializeLibSessionUtilWrappers needs our publicKey to be set
await Storage.put('primaryDevicePubKey', ourPubkey);
@ -208,5 +213,6 @@ async function registrationDone(ourPubkey: string, displayName: string) {
window.inboxStore?.dispatch(userActions.userChanged(user));
window?.log?.info('dispatching registration event');
// this will make the poller start fetching messages, needed to find a configuration message
trigger('registration_done');
}

@ -1,10 +1,7 @@
import { Storage } from './storage';
async function markEverDone() {
await Storage.put('chromiumRegistrationDoneEver', '');
}
async function markDone() {
await markEverDone();
await Storage.put('chromiumRegistrationDoneEver', '');
await Storage.put('chromiumRegistrationDone', '');
}
function isDone() {
@ -20,4 +17,4 @@ async function remove() {
await Storage.remove('chromiumRegistrationDone');
}
export const Registration = { markEverDone, markDone, isDone, everDone, remove };
export const Registration = { markDone, isDone, everDone, remove };

Loading…
Cancel
Save