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 @@ -97,19 +97,19 @@ const _mapValuesWithKeys = _mapValues.convert({ cap: false }); // Input must already be ordered! -function threadsToMessageIDsFromMessageInfos( +function mapThreadsToMessageIDsFromOrderedMessageInfos( orderedMessageInfos: $ReadOnlyArray<RawMessageInfo>, ): { [threadID: string]: string[] } { - const threads: { [threadID: string]: string[] } = {}; + const threadsToMessageIDs: { [threadID: string]: string[] } = {}; for (const messageInfo of orderedMessageInfos) { const key = messageID(messageInfo); - if (!threads[messageInfo.threadID]) { - threads[messageInfo.threadID] = [key]; + if (!threadsToMessageIDs[messageInfo.threadID]) { + threadsToMessageIDs[messageInfo.threadID] = [key]; } else { - threads[messageInfo.threadID].push(key); + threadsToMessageIDs[messageInfo.threadID].push(key); } } - return threads; + return threadsToMessageIDs; } function isThreadWatched( @@ -144,7 +144,7 @@ payload: { id: messageID(messageInfo), messageInfo }, })); - const threadsToMessageIDs = threadsToMessageIDsFromMessageInfos( + const threadsToMessageIDs = mapThreadsToMessageIDsFromOrderedMessageInfos( orderedMessageInfos, ); const lastPruned = Date.now(); @@ -406,7 +406,7 @@ )(unshimmedNewMessagesOfWatchedThreads); const newMessageOps: MessageStoreOperation[] = []; - const threadsToMessageIDs = threadsToMessageIDsFromMessageInfos( + const threadsToMessageIDs = mapThreadsToMessageIDsFromOrderedMessageInfos( orderedNewMessageInfos, ); const oldMessageInfosToCombine = [];