diff --git a/src/stores/ConversationStore.js b/src/stores/ConversationStore.js index 18a3600..0d00574 100644 --- a/src/stores/ConversationStore.js +++ b/src/stores/ConversationStore.js @@ -304,7 +304,12 @@ const conversationSlice = (set, get) => ({ // conversationsList: [...conversationsList], })); }, - updateCurrentConversation: (conversation) => set((state) => ({ currentConversation: { ...state.currentConversation, ...conversation } })), + updateCurrentConversation: (conversation) => { + const { updateConversationItem, currentConversation } = get(); + updateConversationItem({...currentConversation, ...conversation}) + + return set((state) => ({ currentConversation: { ...state.currentConversation, ...conversation } })) + }, updateConversationItem: (conversation) => { const { conversationsList } = get(); const targetId = conversation.sn; @@ -443,8 +448,10 @@ const messageSlice = (set, get) => ({ "whatsapp_phone_number": message.type === 'email' ? null : message.from, }, }; - conversationsList.splice(targetIndex, 1); - conversationsList.unshift(newConversation); + if (String(targetId)!== '0') { + conversationsList.splice(targetIndex, 1); + conversationsList.unshift(newConversation); + } // console.log('find in list, i:', targetIndex); // console.log('find in list, chat updated and Top: \n', JSON.stringify(newConversation, null, 2)); // console.log('list updated : \n', JSON.stringify(conversationsList, null, 2)); diff --git a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx index 8869643..a6639ba 100644 --- a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx +++ b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx @@ -211,6 +211,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, toEma form.setFieldsValue(_formValues); setInitialForm(_formValues); } else if (action === 'forward') { + setStickToCid('0'); form.setFieldsValue(forwardValues); setInitialForm(forwardValues); } else if (action === 'edit') {