diff --git a/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts b/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts index 6901254f2..9142a3356 100644 --- a/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts +++ b/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts @@ -38,6 +38,7 @@ describe('normalizeSoapboxConfig()', () => { it('upgrades singleUserModeProfile to redirectRootNoLogin', () => { expect(normalizeSoapboxConfig({ singleUserMode: true, singleUserModeProfile: 'alex' }).redirectRootNoLogin).toBe('/@alex'); expect(normalizeSoapboxConfig({ singleUserMode: true, singleUserModeProfile: '@alex' }).redirectRootNoLogin).toBe('/@alex'); + expect(normalizeSoapboxConfig({ singleUserMode: true, singleUserModeProfile: 'alex@gleasonator.com' }).redirectRootNoLogin).toBe('/@alex@gleasonator.com'); expect(normalizeSoapboxConfig({ singleUserMode: false, singleUserModeProfile: 'alex' }).redirectRootNoLogin).toBe(''); }); diff --git a/app/soapbox/normalizers/soapbox/soapbox-config.ts b/app/soapbox/normalizers/soapbox/soapbox-config.ts index dfac8a777..3b8b2ea91 100644 --- a/app/soapbox/normalizers/soapbox/soapbox-config.ts +++ b/app/soapbox/normalizers/soapbox/soapbox-config.ts @@ -6,6 +6,7 @@ import { } from 'immutable'; import trimStart from 'lodash/trimStart'; +import { normalizeUsername } from 'soapbox/utils/input'; import { toTailwind } from 'soapbox/utils/tailwind'; import { generateAccent } from 'soapbox/utils/theme'; @@ -204,7 +205,7 @@ const upgradeSingleUserMode = (soapboxConfig: SoapboxConfigMap): SoapboxConfigMa if (!redirectRootNoLogin && singleUserMode && singleUserModeProfile) { return soapboxConfig - .set('redirectRootNoLogin', `/@${singleUserModeProfile.replaceAll('@', '')}`) + .set('redirectRootNoLogin', `/@${normalizeUsername(singleUserModeProfile)}`) .deleteAll(['singleUserMode', 'singleUserModeProfile']); } else { return soapboxConfig