diff --git a/lib/shared/threads/protocols/dm-thread-protocol.js b/lib/shared/threads/protocols/dm-thread-protocol.js --- a/lib/shared/threads/protocols/dm-thread-protocol.js +++ b/lib/shared/threads/protocols/dm-thread-protocol.js @@ -916,6 +916,8 @@ threadActivityUpdatedByDMActivityHandler: true, membershipMessageNotifAction: messageNotifyTypes.SET_UNREAD, + + shouldConvertIDs: false, }); function pendingThreadType(numberOfOtherMembers: number) { diff --git a/lib/shared/threads/protocols/keyserver-thread-protocol.js b/lib/shared/threads/protocols/keyserver-thread-protocol.js --- a/lib/shared/threads/protocols/keyserver-thread-protocol.js +++ b/lib/shared/threads/protocols/keyserver-thread-protocol.js @@ -674,6 +674,8 @@ threadActivityUpdatedByDMActivityHandler: false, membershipMessageNotifAction: messageNotifyTypes.NONE, + + shouldConvertIDs: true, }); function pendingThreadType(numberOfOtherMembers: number) { diff --git a/lib/shared/threads/protocols/thread-protocols.js b/lib/shared/threads/protocols/thread-protocols.js --- a/lib/shared/threads/protocols/thread-protocols.js +++ b/lib/shared/threads/protocols/thread-protocols.js @@ -9,7 +9,10 @@ keyserverThreadProtocol, ]; -function getProtocolByThreadID(threadID: string): ?ThreadProtocol { +function getProtocolByThreadID(threadID?: ?string): ?ThreadProtocol { + if (!threadID) { + return null; + } return protocols().find(p => p.threadIDMatchesProtocol(threadID)); } diff --git a/lib/shared/threads/thread-spec.js b/lib/shared/threads/thread-spec.js --- a/lib/shared/threads/thread-spec.js +++ b/lib/shared/threads/thread-spec.js @@ -398,6 +398,7 @@ // https://linear.app/comm/issue/ENG-10729/consider-merging-activity-handlers +threadActivityUpdatedByDMActivityHandler: boolean, +membershipMessageNotifAction: MessageNotifyType, + +shouldConvertIDs: boolean, }; export type ThreadSpec< 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,12 +40,7 @@ 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, - thickIDRegex, -} from '../utils/validation-utils.js'; +import { tID, tShape, tUserID } from '../utils/validation-utils.js'; export type LegacyMemberInfo = { +id: string, @@ -532,7 +527,3 @@ +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 @@ -11,9 +11,9 @@ import type { UserStoreOperation } from 'lib/ops/user-store-ops.js'; import { getMessageSearchStoreOps } from 'lib/reducers/db-ops-reducer.js'; import { allUpdatesCurrentAsOfSelector } from 'lib/selectors/keyserver-selectors.js'; +import { getProtocolByThreadID } from 'lib/shared/threads/protocols/thread-protocols.js'; import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ClientStore } from 'lib/types/store-ops-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'; @@ -97,10 +97,11 @@ void (async () => { try { let urlInfo = infoFromURL(decodeURI(window.location.href)); - const isThickThreadOpen = - urlInfo.thread && threadIDIsThick(urlInfo.thread); + const protocol = getProtocolByThreadID(urlInfo.thread); + const isNonConvertibleThreadOpen = + urlInfo.thread && protocol && !protocol.shouldConvertIDs; // Handle older links - if (urlInfo.thread && !isThickThreadOpen) { + if (urlInfo.thread && !isNonConvertibleThreadOpen) { urlInfo = { ...urlInfo, thread: convertIDToNewSchema( @@ -121,7 +122,7 @@ allUpdatesCurrentAsOf, }); - if (isThickThreadOpen) { + if (isNonConvertibleThreadOpen) { payload.navInfo.activeChatThreadID = urlInfo.thread; }