fix: formatting fixes

use profile manager name validation in CreateAccount component
pull/3083/head
William Grant 1 year ago
parent d252662630
commit e05d3a6874

@ -194,17 +194,17 @@ export const EditProfileDialog = () => {
const backButton = const backButton =
mode === 'edit' || mode === 'qr' mode === 'edit' || mode === 'qr'
? [ ? [
{ {
iconType: 'chevron', iconType: 'chevron',
iconRotation: 90, iconRotation: 90,
onClick: () => { onClick: () => {
if (loading) { if (loading) {
return; return;
} }
setMode('default'); setMode('default');
},
}, },
}, ]
]
: undefined; : undefined;
const onClickOK = async () => { const onClickOK = async () => {

@ -35,6 +35,7 @@ import { resetRegistration } from '../RegistrationStages';
import { ContinueButton, OnboardDescription, OnboardHeading } from '../components'; import { ContinueButton, OnboardDescription, OnboardHeading } from '../components';
import { BackButtonWithinContainer } from '../components/BackButton'; import { BackButtonWithinContainer } from '../components/BackButton';
import { displayNameIsValid, sanitizeDisplayNameOrToast } from '../utils'; import { displayNameIsValid, sanitizeDisplayNameOrToast } from '../utils';
import { ProfileManager } from '../../../session/profile_manager/ProfileManager';
export type AccountDetails = { export type AccountDetails = {
recoveryPassword: string; recoveryPassword: string;
@ -100,8 +101,10 @@ export const CreateAccount = () => {
throw new Error('Private key not found'); throw new Error('Private key not found');
} }
const validName = await ProfileManager.updateOurProfileDisplayName(displayName, true);
await signUp({ await signUp({
displayName, displayName: validName,
recoveryPassword, recoveryPassword,
}); });

@ -125,7 +125,6 @@ async function retrieveNextMessages(
); );
// let exceptions bubble up // let exceptions bubble up
// no retry for this one as this a call we do every few seconds while polling for messages // no retry for this one as this a call we do every few seconds while polling for messages
// TODO[epic=ses-825] will this happen before the retrieve display name timeout and break things?
const timeOutMs = 10 * DURATION.SECONDS; // yes this is a long timeout for just messages, but 4s timeouts way to often... const timeOutMs = 10 * DURATION.SECONDS; // yes this is a long timeout for just messages, but 4s timeouts way to often...
const timeoutPromise = async () => sleepFor(timeOutMs); const timeoutPromise = async () => sleepFor(timeOutMs);
const fetchPromise = async () => const fetchPromise = async () =>

@ -99,8 +99,18 @@ export async function updateOurProfileDisplayName(newName: string, onboarding?:
const cleanName = sanitizeSessionUsername(newName).trim(); const cleanName = sanitizeSessionUsername(newName).trim();
if (onboarding) { if (onboarding) {
const userInfoName = await UserConfigWrapperActions.setUserInfo(cleanName, CONVERSATION_PRIORITIES.default, null); try {
return userInfoName; const userInfoName = await UserConfigWrapperActions.setUserInfo(
cleanName,
CONVERSATION_PRIORITIES.default,
null
);
return userInfoName;
} catch (err) {
throw err;
} finally {
await UserConfigWrapperActions.free();
}
} }
const ourNumber = UserUtils.getOurPubKeyStrFromCache(); const ourNumber = UserUtils.getOurPubKeyStrFromCache();
@ -120,9 +130,9 @@ export async function updateOurProfileDisplayName(newName: string, onboarding?:
dbPriority, dbPriority,
dbProfileUrl && dbProfileKey dbProfileUrl && dbProfileKey
? { ? {
url: dbProfileUrl, url: dbProfileUrl,
key: dbProfileKey, key: dbProfileKey,
} }
: null : null
); );

@ -26,7 +26,6 @@ describe('AvatarPlaceHolder', () => {
}); });
it('should render an svg', async () => { it('should render an svg', async () => {
// TODO[epic=ses-968] Fix warnings that appear when we run this test.
const result = renderComponent( const result = renderComponent(
<AvatarPlaceHolder <AvatarPlaceHolder
diameter={AvatarSize.XL} diameter={AvatarSize.XL}

Loading…
Cancel
Save