diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -40,7 +40,12 @@ import type { UserInfo, UserInfos } from './user-types.js'; import type { SpecialRole } from '../permissions/special-roles.js'; import { type ThreadEntity } from '../utils/entity-text.js'; -import { tID, tShape, tUserID } from '../utils/validation-utils.js'; +import { + tID, + tShape, + tUserID, + thickIDRegex, +} from '../utils/validation-utils.js'; export type LegacyMemberInfo = { +id: string, @@ -537,3 +542,7 @@ +threadInfo: ThreadInfo, +pendingPersonalThreadUserInfo?: UserInfo, }; + +export function threadIDIsThick(threadID: string): boolean { + return thickIDRegex.test(threadID); +} diff --git a/web/redux/initial-state-gate.js b/web/redux/initial-state-gate.js --- a/web/redux/initial-state-gate.js +++ b/web/redux/initial-state-gate.js @@ -12,12 +12,12 @@ import { getMessageSearchStoreOps } from 'lib/reducers/db-ops-reducer.js'; import { allUpdatesCurrentAsOfSelector } from 'lib/selectors/keyserver-selectors.js'; import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import { threadIDIsThick } from 'lib/types/thread-types.js'; import { getConfig } from 'lib/utils/config.js'; import { convertIDToNewSchema } from 'lib/utils/migration-utils.js'; import { entries, values } from 'lib/utils/objects.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import { infoFromURL } from 'lib/utils/url-utils.js'; -import { thickIDRegex } from 'lib/utils/validation-utils.js'; import { setInitialReduxState, @@ -58,7 +58,7 @@ try { let urlInfo = infoFromURL(decodeURI(window.location.href)); const isThickThreadOpen = - urlInfo.thread && thickIDRegex.test(urlInfo.thread); + urlInfo.thread && threadIDIsThick(urlInfo.thread); // Handle older links if (urlInfo.thread && !isThickThreadOpen) { urlInfo = {