From 5ecea0356620c1ef096cd75fd8350b127ebd0635 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 3 Dec 2024 11:38:35 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=B8=BB=E5=8A=A8=E6=94=B6=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/channel/bubbleMsgUtils.js | 5 ++++- src/stores/ConversationStore.js | 2 +- src/views/Conversations/Online/Components/EmailFetch.jsx | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/channel/bubbleMsgUtils.js b/src/channel/bubbleMsgUtils.js index b1ef5b8..e2dd6fa 100644 --- a/src/channel/bubbleMsgUtils.js +++ b/src/channel/bubbleMsgUtils.js @@ -354,7 +354,7 @@ const emailMsgMapped = { }, 'email.action.received': { getMsg: (result) => { - return isEmpty(result?.emailMessage) ? null : { ...result.emailMessage, }; + return isEmpty(result?.emailMessage) ? null : { ...result.emailMessage, id: result.id }; }, contentToRender: (contentObj) => null, contentToUpdate: (msgcontent) => null, @@ -362,6 +362,7 @@ const emailMsgMapped = { return { ...contentObj, status: contentObj?.status || 'failed', + key: contentObj.email || contentObj.from || '', content: `${contentObj.email || contentObj.from || '未知邮箱'} ${contentObj?.error?.message || ''}`, title: (contentObj.status === 'failed') ? `接收邮件失败` : '', type: (contentObj.status === 'failed') ? 'warning' : 'info', @@ -742,6 +743,8 @@ export const parseRenderMessageList = (messages) => { dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? `${(msg.msgtime || '').replace('T', ' ')} 发送失败 ${waError} ❌` : '', statusCN: msgStatusRenderMappedCN[msgContent?.status || 'failed'], statusTitle: msgStatusRenderMappedCN[msgContent?.status || 'failed'], + id: (msgContent?.status || 'failed') === 'failed' ? msgContent.actionId : msg.id, + actionId: msgContent.actionId, } : {}), ...(isEmpty(messageorigin) && (isEmpty(msgContent.context) || msgContent.context?.forwarded === true) diff --git a/src/stores/ConversationStore.js b/src/stores/ConversationStore.js index ad9cb34..0485bee 100644 --- a/src/stores/ConversationStore.js +++ b/src/stores/ConversationStore.js @@ -59,7 +59,7 @@ const initialConversationState = { const globalNotifySlice = (set) => ({ globalNotify: [], setGlobalNotify: (notify) => set(() => ({ globalNotify: notify })), - addGlobalNotify: (notify) => set((state) => ({ globalNotify: [...state.globalNotify, notify] })), + addGlobalNotify: (notify) => set((state) => ({ globalNotify: [notify, ...state.globalNotify] })), removeGlobalNotify: (id) => set((state) => ({ globalNotify: state.globalNotify.filter(item => item.id !== id) })), clearGlobalNotify: () => set(() => ({ globalNotify: [] })), }) diff --git a/src/views/Conversations/Online/Components/EmailFetch.jsx b/src/views/Conversations/Online/Components/EmailFetch.jsx index 1412316..878092e 100644 --- a/src/views/Conversations/Online/Components/EmailFetch.jsx +++ b/src/views/Conversations/Online/Components/EmailFetch.jsx @@ -18,10 +18,10 @@ const EmailFetch = ({ ...props }) => { } // message.info(globalNotify[0].content, 3) notification.open({ - key: globalNotify[0].id, + key: globalNotify[0].key, message: globalNotify[0].title, description: globalNotify[0].content, - duration: 0, + duration: 5, placement: 'top', type: globalNotify[0].type, onClick: () => {