|
|
|
@ -339,7 +339,7 @@ const messageSlice = (set, get) => ({
|
|
|
|
|
// msgUpdate
|
|
|
|
|
// console.log('UPDATE_SENT_MESSAGE_ITEM-----------------------------------------------------------------', message);
|
|
|
|
|
// 更新会话中的消息
|
|
|
|
|
const { activeConversations, conversationsList, currentConversation } = get();
|
|
|
|
|
const { activeConversations, conversationsList, currentConversation, setFilter } = get();
|
|
|
|
|
const targetId = message.conversationid;
|
|
|
|
|
const targetMsgs = (activeConversations[String(targetId)] || []).map((ele) => {
|
|
|
|
|
// 更新状态
|
|
|
|
@ -395,6 +395,7 @@ const messageSlice = (set, get) => ({
|
|
|
|
|
}
|
|
|
|
|
const mergedList = [...newConversations, ...conversationsList]
|
|
|
|
|
const mergedListMapped = groupBy(mergedList, 'top_state');
|
|
|
|
|
setFilter({ loadNextPage: true });
|
|
|
|
|
|
|
|
|
|
return set({
|
|
|
|
|
topList: mergedListMapped['1'] || [],
|
|
|
|
@ -405,7 +406,7 @@ const messageSlice = (set, get) => ({
|
|
|
|
|
},
|
|
|
|
|
sentOrReceivedNewMessage: (targetId, message) => {
|
|
|
|
|
// msgRender:
|
|
|
|
|
const { activeConversations, conversationsList, currentConversation, totalNotify } = get();
|
|
|
|
|
const { activeConversations, conversationsList, currentConversation, totalNotify, setFilter } = get();
|
|
|
|
|
const targetMsgs = activeConversations[String(targetId)] || [];
|
|
|
|
|
const targetIndex = conversationsList.findIndex((ele) => Number(ele.sn) === Number(targetId));
|
|
|
|
|
const lastReceivedTime = (message.type !== 'system' && message.sender !== 'me') ? dayjs(message.date).add(8, 'hours').format(DATETIME_FORMAT) : null;
|
|
|
|
@ -444,6 +445,7 @@ const messageSlice = (set, get) => ({
|
|
|
|
|
// 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));
|
|
|
|
|
const mergedListMapped = groupBy(conversationsList, 'top_state');
|
|
|
|
|
setFilter({ loadNextPage: true });
|
|
|
|
|
|
|
|
|
|
const isCurrent = Number(targetId) === Number(currentConversation.sn);
|
|
|
|
|
const updatedCurrent = isCurrent
|
|
|
|
|