From 936afa1673c9821ba94e398cba496f6e78d81e12 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Mon, 18 Jan 2021 09:46:19 +0000 Subject: [PATCH] Fix chat filter to find UnconfirmedDirectChats (#79) --- src/website/public/reducers/chatsReducer.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/website/public/reducers/chatsReducer.ts b/src/website/public/reducers/chatsReducer.ts index d793c58df5..83ba01befe 100644 --- a/src/website/public/reducers/chatsReducer.ts +++ b/src/website/public/reducers/chatsReducer.ts @@ -180,7 +180,11 @@ export default produce((state: ChatsState, event: Event) => { const unconfirmedGroupChat = state.chats.find(c => c.kind === UNCONFIRMED_GROUP_CHAT) as UnconfirmedGroupChat; for (const updatedChat of chats) { - const currentChat = chatFunctions.tryGetChat(state.chats, { chatId: updatedChat.chatId })[0] as Option; + const filter = { + chatId: updatedChat.chatId, + userId: chatFunctions.isDirectChat(updatedChat) ? updatedChat.them : undefined + }; + const currentChat = chatFunctions.tryGetChat(state.chats, filter)[0] as Option; if (currentChat) { // These messages have just come from the server so are all of type LocalMessage