diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -17,7 +17,6 @@ includeDeletedSelector, } from './calendar-filter-selectors.js'; import { relativeMemberInfoSelectorForMembersOfThread } from './user-selectors.js'; -import genesis from '../facts/genesis.js'; import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js'; import { getAvatarForThread, @@ -35,6 +34,7 @@ getPendingThreadID, } from '../shared/thread-utils.js'; import { + threadSpecs, personalThreadTypes, privateThreadTypes, sidebarThreadTypes, @@ -53,11 +53,7 @@ ThickRawThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAppState } from '../types/redux-types.js'; -import { - threadTypeIsThick, - type ThreadType, - threadTypes, -} from '../types/thread-types-enum.js'; +import { type ThreadType, threadTypes } from '../types/thread-types-enum.js'; import type { MixedRawThreadInfos, RawThreadInfos, @@ -461,9 +457,9 @@ const rawThreadInfo = rawThreadInfos[threadID]; if ( threadIsPending(threadID) || - (rawThreadInfo.parentThreadID !== genesis().id && - !threadTypeIsSidebar(rawThreadInfo.type) && - !threadTypeIsThick(rawThreadInfo.type)) + !threadSpecs[ + rawThreadInfo.type + ].protocol.couldBeCreatedFromPendingThread(rawThreadInfo) ) { continue; } 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 @@ -727,6 +727,8 @@ }; }, + couldBeCreatedFromPendingThread: () => true, + allowsDeletingSidebarSource: false, presentationDetails: { 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 @@ -18,6 +18,7 @@ type MediaMetadataReassignmentAction, updateMultimediaMessageMediaActionType, } from '../../../actions/upload-actions.js'; +import genesis from '../../../facts/genesis.js'; import { encryptedMediaBlobURI, encryptedVideoThumbnailBlobURI, @@ -43,6 +44,7 @@ ThreadCurrentUserInfo, ThinRawThreadInfo, MemberInfoSansPermissions, + RawThreadInfo, } from '../../../types/minimally-encoded-thread-permissions-types.js'; import { minimallyEncodeThreadCurrentUserInfo } from '../../../types/minimally-encoded-thread-permissions-types.js'; import type { Dispatch } from '../../../types/redux-types.js'; @@ -95,6 +97,7 @@ ProtocolFetchMessageInput, ProtocolCreatePendingThreadInput, } from '../thread-spec.js'; +import { threadTypeIsSidebar } from '../thread-specs.js'; const keyserverThreadProtocol: ThreadProtocol = Object.freeze({ @@ -490,6 +493,13 @@ }; }, + couldBeCreatedFromPendingThread: (thread: RawThreadInfo) => { + return ( + thread.parentThreadID === genesis().id || + threadTypeIsSidebar(thread.type) + ); + }, + allowsDeletingSidebarSource: true, presentationDetails: { 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 @@ -310,6 +310,7 @@ +createPendingThread: ( input: ProtocolCreatePendingThreadInput, ) => RawThreadInfo, + +couldBeCreatedFromPendingThread: (thread: RawThreadInfo) => boolean, +allowsDeletingSidebarSource: boolean, +presentationDetails: { +membershipChangesShownInThreadPreview: boolean,