diff --git a/lib/utils/validation-utils.js b/lib/utils/validation-utils.js --- a/lib/utils/validation-utils.js +++ b/lib/utils/validation-utils.js @@ -113,6 +113,7 @@ const idSchemaRegex = `(?:(?:[0-9]+|${uuidRegex})\\|)?(?:[0-9]+|${uuidRegex})`; const pendingThreadIDRegex = `pending/(type[0-9]+/[0-9]+(\\+[0-9]+)*|sidebar/${idSchemaRegex})`; +const thickThreadIDRegex: RegExp = new RegExp(`^${uuidRegex}$`); const chatNameMaxLength = 191; const chatNameMinLength = 0; @@ -146,6 +147,7 @@ ashoatKeyserverID, idSchemaRegex, pendingThreadIDRegex, + thickThreadIDRegex, validChatNameRegex, validChatNameRegexString, chatNameMaxLength, diff --git a/web/redux/action-types.js b/web/redux/action-types.js --- a/web/redux/action-types.js +++ b/web/redux/action-types.js @@ -1,6 +1,6 @@ // @flow -import { extractKeyserverIDFromID } from 'lib/keyserver-conn/keyserver-call-utils.js'; +import { extractKeyserverIDFromIDOptional } from 'lib/keyserver-conn/keyserver-call-utils.js'; import { useKeyserverCall } from 'lib/keyserver-conn/keyserver-call.js'; import type { CallKeyserverEndpoint } from 'lib/keyserver-conn/keyserver-conn-types.js'; import { defaultCalendarFilters } from 'lib/types/filter-types.js'; @@ -42,7 +42,9 @@ const requests: { [string]: InitialReduxStateRequest } = {}; const { urlInfo, excludedData, allUpdatesCurrentAsOf } = input; const { thread, inviteSecret, ...rest } = urlInfo; - const threadKeyserverID = thread ? extractKeyserverIDFromID(thread) : null; + const threadKeyserverID = thread + ? extractKeyserverIDFromIDOptional(thread) + : null; for (const keyserverID of allKeyserverIDs) { const clientUpdatesCurrentAsOf = allUpdatesCurrentAsOf[keyserverID]; 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 @@ -17,6 +17,7 @@ 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 { thickThreadIDRegex } from 'lib/utils/validation-utils.js'; import { setInitialReduxState, @@ -56,8 +57,10 @@ void (async () => { try { let urlInfo = infoFromURL(decodeURI(window.location.href)); + const isThickThreadOpen = + urlInfo.thread && thickThreadIDRegex.test(urlInfo.thread); // Handle older links - if (urlInfo.thread) { + if (urlInfo.thread && !isThickThreadOpen) { urlInfo = { ...urlInfo, thread: convertIDToNewSchema( @@ -83,6 +86,10 @@ allUpdatesCurrentAsOf, }); + if (isThickThreadOpen) { + payload.navInfo.activeChatThreadID = urlInfo.thread; + } + const currentLoggedInUserID = payload.currentUserInfo?.anonymous ? null : payload.currentUserInfo?.id;