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 @@ -47,6 +47,8 @@ } from '../actions/thread-actions.js'; import { updateMultimediaMessageMediaActionType } from '../actions/upload-actions.js'; import { + keyserverAuthActionTypes, + tempIdentityLoginActionTypes, logOutActionTypes, deleteKeyserverAccountActionTypes, logInActionTypes, @@ -101,6 +103,7 @@ processUpdatesActionType, } from '../types/update-types.js'; import { translateClientDBThreadMessageInfos } from '../utils/message-ops-utils.js'; +import { ashoatKeyserverID } from '../utils/validation-utils.js'; const _mapValuesWithKeys = _mapValues.convert({ cap: false }); @@ -745,6 +748,31 @@ threads: processedMessageStore.threads, }, }; + } else if (action.type === tempIdentityLoginActionTypes.success) { + const { messageStoreOperations, messageStore: freshStore } = + freshMessageStore([], {}, { [ashoatKeyserverID]: 0 }, newThreadInfos); + + const processedMessageStore = processMessageStoreOperations( + messageStore, + messageStoreOperations, + ); + + return { + messageStoreOperations, + messageStore: { + ...freshStore, + messages: processedMessageStore.messages, + threads: processedMessageStore.threads, + }, + }; + } else if (action.type === keyserverAuthActionTypes.success) { + const { messagesResult } = action.payload; + return mergeNewMessages( + messageStore, + messagesResult.messageInfos, + messagesResult.truncationStatus, + newThreadInfos, + ); } else if (action.type === incrementalStateSyncActionType) { if ( action.payload.messagesResult.rawMessageInfos.length === 0 &&