diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js --- a/lib/reducers/message-reducer.js +++ b/lib/reducers/message-reducer.js @@ -82,6 +82,7 @@ threadIsPending, } from '../shared/thread-utils.js'; import threadWatcher from '../shared/thread-watcher.js'; +import { threadSpecs } from '../shared/threads/thread-specs.js'; import { unshimMessageInfos } from '../shared/unshim-utils.js'; import { updateSpecs } from '../shared/updates/update-specs.js'; import { recoveryFromReduxActionSources } from '../types/account-types.js'; @@ -110,7 +111,6 @@ stateSyncPayloadTypes, } from '../types/socket-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import { threadTypeIsThick } from '../types/thread-types-enum.js'; import type { LegacyRawThreadInfo, RawThreadInfos, @@ -151,7 +151,7 @@ threadHasPermission(threadInfo, threadPermissions.VISIBLE) && (threadInChatList(threadInfo) || watchedIDs.includes(threadID) || - threadTypeIsThick(threadInfo.type))) + !threadSpecs[threadInfo.type].protocol.messagesStoredOnServer)) ); } @@ -635,24 +635,25 @@ payload: { threads: Object.fromEntries( Object.entries(updatedThreads).map(([threadID, thread]) => { - let isThreadThick; + let threadType; if (threadInfos[threadID]) { - isThreadThick = threadInfos[threadID].thick; + threadType = threadInfos[threadID].type; } else { const threadIDParseResult = parsePendingThreadID(threadID); - isThreadThick = threadIDParseResult - ? threadTypeIsThick(threadIDParseResult.threadType) - : false; + threadType = threadIDParseResult?.threadType; } + const messagesStoredOnServer = threadType + ? threadSpecs[threadType].protocol.messagesStoredOnServer + : false; return [ threadID, - isThreadThick - ? { + messagesStoredOnServer + ? thread + : { ...thread, startReached: thread.messageIDs.length < defaultNumberPerThread, - } - : thread, + }, ]; }), ), 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 @@ -574,6 +574,8 @@ }, shouldPerformSideEffectsBeforeSendingMessage: false, + + messagesStoredOnServer: false, }); export { dmThreadProtocol }; 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 @@ -370,6 +370,8 @@ }, shouldPerformSideEffectsBeforeSendingMessage: true, + + messagesStoredOnServer: true, }); function mediaIDIsKeyserverID(mediaID: string): boolean { 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 @@ -275,6 +275,7 @@ +pendingSidebarURLPrefix: string, }, +shouldPerformSideEffectsBeforeSendingMessage: boolean, + +messagesStoredOnServer: boolean, }; export type ThreadSpec = {