fix: 切换之后引用消息的id

dev/emitter
Lei OT 10 months ago
parent 915d956e1b
commit eb7075633b

@ -444,7 +444,7 @@ export const whatsappMsgTypeMapped = {
},
text: {
type: 'text',
data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || msg?.from || '' }),
data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || msg?.from || '', idx: '--------------------------------------' }),
renderForReply: (msg) => ({ id: msg.wamid, message: msg?.text?.body }),
},
image: {
@ -719,10 +719,12 @@ export const parseRenderMessageList = (messages) => {
waError = whatsappError.INVALID_PHONE_NUMBER;
}
}
const msgTypeData = whatsappMsgTypeMapped?.[msgType]?.data(msgContent) || {};
return {
...msg,
msgOrigin: { ...msgContent, ...msgContent.email },
...(whatsappMsgTypeMapped?.[msgType]?.data(msgContent) || {}),
// id: msg.id || msgContent.wamid || msgContent.id,
...msgTypeData,
type: msgContent.type,
...(typeof whatsappMsgTypeMapped[msgType].type === 'function' ? whatsappMsgTypeMapped[msgType].type(msg) : { type: whatsappMsgTypeMapped[msgType].type || 'text' }),
date: msg.msgtime, // msgContent?.sendTime || msg.msgtime || '',
@ -743,7 +745,7 @@ 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,
id: (msgContent?.status || 'failed') === 'failed' ? msgContent.actionId : (msgTypeData.id || msg.id),
actionId: msgContent.actionId,
replyButton: !['waiting', 'failed'].includes(msgContent?.status || 'failed') ,
}

Loading…
Cancel
Save