perf: 主动收件的提示

dev/emitter
Lei OT 10 months ago
parent b8497f155c
commit 5ecea03566

@ -354,7 +354,7 @@ const emailMsgMapped = {
}, },
'email.action.received': { 'email.action.received': {
getMsg: (result) => { getMsg: (result) => {
return isEmpty(result?.emailMessage) ? null : { ...result.emailMessage, }; return isEmpty(result?.emailMessage) ? null : { ...result.emailMessage, id: result.id };
}, },
contentToRender: (contentObj) => null, contentToRender: (contentObj) => null,
contentToUpdate: (msgcontent) => null, contentToUpdate: (msgcontent) => null,
@ -362,6 +362,7 @@ const emailMsgMapped = {
return { return {
...contentObj, ...contentObj,
status: contentObj?.status || 'failed', status: contentObj?.status || 'failed',
key: contentObj.email || contentObj.from || '',
content: `${contentObj.email || contentObj.from || '未知邮箱'} ${contentObj?.error?.message || ''}`, content: `${contentObj.email || contentObj.from || '未知邮箱'} ${contentObj?.error?.message || ''}`,
title: (contentObj.status === 'failed') ? `接收邮件失败` : '', title: (contentObj.status === 'failed') ? `接收邮件失败` : '',
type: (contentObj.status === 'failed') ? 'warning' : 'info', 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}` : '', dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? `${(msg.msgtime || '').replace('T', ' ')} 发送失败 ${waError}` : '',
statusCN: msgStatusRenderMappedCN[msgContent?.status || 'failed'], statusCN: msgStatusRenderMappedCN[msgContent?.status || 'failed'],
statusTitle: 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) ...(isEmpty(messageorigin) && (isEmpty(msgContent.context) || msgContent.context?.forwarded === true)

@ -59,7 +59,7 @@ const initialConversationState = {
const globalNotifySlice = (set) => ({ const globalNotifySlice = (set) => ({
globalNotify: [], globalNotify: [],
setGlobalNotify: (notify) => set(() => ({ globalNotify: notify })), 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) })), removeGlobalNotify: (id) => set((state) => ({ globalNotify: state.globalNotify.filter(item => item.id !== id) })),
clearGlobalNotify: () => set(() => ({ globalNotify: [] })), clearGlobalNotify: () => set(() => ({ globalNotify: [] })),
}) })

@ -18,10 +18,10 @@ const EmailFetch = ({ ...props }) => {
} }
// message.info(globalNotify[0].content, 3) // message.info(globalNotify[0].content, 3)
notification.open({ notification.open({
key: globalNotify[0].id, key: globalNotify[0].key,
message: globalNotify[0].title, message: globalNotify[0].title,
description: globalNotify[0].content, description: globalNotify[0].content,
duration: 0, duration: 5,
placement: 'top', placement: 'top',
type: globalNotify[0].type, type: globalNotify[0].type,
onClick: () => { onClick: () => {

Loading…
Cancel
Save