diff --git a/lib/shared/sidebar-utils.js b/lib/shared/sidebar-utils.js --- a/lib/shared/sidebar-utils.js +++ b/lib/shared/sidebar-utils.js @@ -102,11 +102,11 @@ } } + const config = threadSpecs[parentThreadInfo.type].protocol().sidebarConfig; + invariant(config, `Thread type ${parentThreadInfo.type} can't have sidebars`); return createPendingThread({ viewerID, - threadType: - threadSpecs[parentThreadInfo.type].protocol().sidebarConfig - .sidebarThreadType, + threadType: config.sidebarThreadType, members: [...initialMembers.values()], parentThreadInfo, threadColor: color, diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -392,8 +392,9 @@ ): string { let pendingThreadKey; if (sourceMessageID) { - const prefix = - threadSpecs[threadType].protocol().sidebarConfig.pendingSidebarURLPrefix; + const config = threadSpecs[threadType].protocol().sidebarConfig; + invariant(config, `Thread type ${threadType} doesn't support sidebars`); + const prefix = config.pendingSidebarURLPrefix; pendingThreadKey = `${prefix}/${sourceMessageID}`; } else { pendingThreadKey = [...memberIDs].sort().join('+'); @@ -421,8 +422,8 @@ const [threadTypeString, threadKey] = pendingThreadIDMatches[1].split('/'); const threadType = protocols().find( - p => p.sidebarConfig.pendingSidebarURLPrefix === threadTypeString, - )?.sidebarConfig.sidebarThreadType ?? + p => p.sidebarConfig?.pendingSidebarURLPrefix === threadTypeString, + )?.sidebarConfig?.sidebarThreadType ?? assertThreadType(Number(threadTypeString.replace('type', ''))); const threadTypeStringIsSidebar = threadTypeIsSidebar(threadType); @@ -1464,9 +1465,9 @@ return threadInfo; } members.push(...mentionedNewMembers); - const threadType = - threadSpecs[parentThreadInfo.type].protocol().sidebarConfig - .sidebarThreadType; + const config = threadSpecs[parentThreadInfo.type].protocol().sidebarConfig; + invariant(config, `Thread type ${parentThreadInfo.type} can't have sidebars`); + const threadType = config.sidebarThreadType; return createPendingThread({ viewerID, diff --git a/lib/shared/threads/protocols/farcaster-thread-protocol.js b/lib/shared/threads/protocols/farcaster-thread-protocol.js --- a/lib/shared/threads/protocols/farcaster-thread-protocol.js +++ b/lib/shared/threads/protocols/farcaster-thread-protocol.js @@ -17,15 +17,11 @@ } from '../../../types/minimally-encoded-thread-permissions-types.js'; import type { SubscriptionUpdateResult } from '../../../types/subscription-types.js'; import type { ThreadType } from '../../../types/thread-types-enum.js'; -import { thickThreadTypes } from '../../../types/thread-types-enum.js'; import type { ChangeThreadSettingsPayload, ThreadJoinPayload, } from '../../../types/thread-types.js'; -import { - farcasterThreadIDRegExp, - pendingThickSidebarURLPrefix, -} from '../../../utils/validation-utils.js'; +import { farcasterThreadIDRegExp } from '../../../utils/validation-utils.js'; import { messageNotifyTypes } from '../../messages/message-spec.js'; import type { ThreadProtocol } from '../thread-spec.js'; @@ -149,13 +145,6 @@ uploadMultimediaMetadataToKeyserver: false, canActionsTargetPendingMessages: false, - - sidebarConfig: { - //TODO: Add this after ENG-10944 - sidebarThreadType: thickThreadTypes.THICK_SIDEBAR, - pendingSidebarURLPrefix: pendingThickSidebarURLPrefix, - }, - messagesStoredOnServer: false, arePendingThreadsDescendantsOfGenesis: false, threadActivityUpdatedByDMActivityHandler: false, 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 @@ -389,7 +389,7 @@ }, +uploadMultimediaMetadataToKeyserver: boolean, +canActionsTargetPendingMessages: boolean, - +sidebarConfig: { + +sidebarConfig?: { +sidebarThreadType: ThreadType, +pendingSidebarURLPrefix: string, },