diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js --- a/native/redux/redux-setup.js +++ b/native/redux/redux-setup.js @@ -315,33 +315,65 @@ return { state, threadStoreOperations: [] }; } - const updatedActiveThreadInfo = { - ...state.threadStore.threadInfos[activeThread], - currentUser: { - ...state.threadStore.threadInfos[activeThread].currentUser, - unread: false, - }, - }; - - const threadStoreOperations = [ - { - type: 'replace', - payload: { - id: activeThread, - threadInfo: updatedActiveThreadInfo, + const activeThreadInfo = state.threadStore.threadInfos[activeThread]; + // TODO (atul): Try to get rid of this ridiculous branching. + if (activeThreadInfo.minimallyEncoded) { + const updatedActiveThreadInfo = { + ...activeThreadInfo, + currentUser: { + ...activeThreadInfo.currentUser, + unread: false, }, - }, - ]; + }; - const updatedThreadStore = threadStoreOpsHandlers.processStoreOperations( - state.threadStore, - threadStoreOperations, - ); + const threadStoreOperations = [ + { + type: 'replace', + payload: { + id: activeThread, + threadInfo: updatedActiveThreadInfo, + }, + }, + ]; - return { - state: { ...state, threadStore: updatedThreadStore }, - threadStoreOperations, - }; + const updatedThreadStore = threadStoreOpsHandlers.processStoreOperations( + state.threadStore, + threadStoreOperations, + ); + + return { + state: { ...state, threadStore: updatedThreadStore }, + threadStoreOperations, + }; + } else { + const updatedActiveThreadInfo = { + ...activeThreadInfo, + currentUser: { + ...activeThreadInfo.currentUser, + unread: false, + }, + }; + + const threadStoreOperations = [ + { + type: 'replace', + payload: { + id: activeThread, + threadInfo: updatedActiveThreadInfo, + }, + }, + ]; + + const updatedThreadStore = threadStoreOpsHandlers.processStoreOperations( + state.threadStore, + threadStoreOperations, + ); + + return { + state: { ...state, threadStore: updatedThreadStore }, + threadStoreOperations, + }; + } } let appLastBecameInactive = 0;