根据类型, 控制是否允许引用

dev/chat
Lei OT 2 years ago
parent bb3168169c
commit 662b614b60

@ -212,6 +212,7 @@ export const parseRenderMessageItem = (msg) => {
customer_name: msg?.customerProfile?.name || '',
whatsapp_name: msg?.customerProfile?.name || '',
whatsapp_phone_number: msg.from,
whatsapp_msg_type: msg.type,
};
};
/**
@ -240,6 +241,7 @@ export const parseRenderMessageList = (messages, conversationid = null) => {
: {}),
// conversationid: conversationid,
// title: msg.customerProfile.name,
whatsapp_msg_type: msgContent.type,
};
});
};

@ -70,10 +70,12 @@ const ConversationReducer = (state = initialState, action) => {
const message = action.payload;
const targetId = message.conversationid;
const targetMsgs = (activeConversations[String(targetId)] || []).map((ele) => {
// 更新状态
// * 已读的不再更新状态, 有时候投递结果在已读之后返回
if (ele.id === ele.actionId && ele.actionId === message.actionId) {
return { ...ele, id: message.id, status: message.status, dateString: message.dateString };
return { ...ele, id: message.id, status: ele.status === 'read' ? ele.status : message.status, dateString: message.dateString };
} else if (ele.id === message.id) {
return { ...ele, id: message.id, status: message.status, dateString: message.dateString };
return { ...ele, id: message.id, status: ele.status === 'read' ? ele.status : message.status, dateString: message.dateString };
}
return ele;
});

@ -102,15 +102,15 @@ const Conversations = () => {
};
const switchConversation = async (item) => {
console.log('invoke switch');
if (String(item.sn) === String(currentConversation.sn)) {
return false;
}
dispatch(setCurrentConversation(item));
const messagesList = activeConversations[`${item.sn}`] || [];
if (isEmpty(messagesList)) {
const data = await fetchMessages({ opisn: userId, whatsappid: item.whatsapp_phone_number });
dispatch(receivedMessageList(item.sn, data));
}
if (String(item.sn) === String(currentConversation.sn)) {
return false;
}
dispatch(setCurrentConversation(item));
};
const onSwitchConversation = (item) => {

@ -48,12 +48,12 @@ const Messages = () => {
notchStyle: { fill: '#ccd5ae' },
// forwarded: false,
// todo: reaction: emoji
replyButton: message.type === 'text' && message.status !== 'failed' ? true : false,
replyButton: ['text'].includes(message.whatsapp_msg_type) && message.status !== 'failed' ? true : false,
onReplyClick: () => dispatch(setReplyTo(message)),
className: 'whatsappme-container whitespace-pre-wrap',
}
: {
replyButton: message.type === 'text' ? true : false,
replyButton: ['text'].includes(message.whatsapp_msg_type) ? true : false,
onReplyClick: () => dispatch(setReplyTo(message)),
})}
// notchStyle={{fill: '#ccd5ae'}}

Loading…
Cancel
Save