test: 新消息: 更新会话时间: 修改判断; console

hotfix/new-conversation
Lei OT 1 year ago
parent 313d3406dd
commit b381fdce6b

@ -332,17 +332,22 @@ const messageSlice = (set, get) => ({
};
conversationsList.splice(targetIndex, 1);
conversationsList.unshift(newConversation);
const isCurrent = Number(targetId) === Number(currentConversation.sn);
const updatedCurrent = isCurrent
? {
...currentConversation,
last_received_time: dayjs(message.date).add(8, 'hours').format(DATETIME_FORMAT),
conversation_expiretime: dayjs(message.date).add(24, 'hours').format(DATETIME_FORMAT),
}
: {...currentConversation};
// const currentI = conversationsList.findIndex((ele) => String(ele.sn) === String(currentConversation.sn));
console.log('message in chat', JSON.stringify(message, null, 2), 'currentConversation', JSON.stringify(currentConversation, null, 2));
console.log('is current and update', isCurrent, JSON.stringify(updatedCurrent, null, 2));
return set({
currentConversation: updatedCurrent,
totalNotify: totalNotify + (message.sender === 'me' ? 0 : 1),
activeConversations: { ...activeConversations, [String(targetId)]: [...targetMsgs, message] },
conversationsList: [...conversationsList],
currentConversation: {
...currentConversation,
...(String(targetId) === String(currentConversation.sn) ? {
last_received_time: dayjs(message.date).add(8, 'hours').format(DATETIME_FORMAT),
conversation_expiretime: dayjs(message.date).add(24, 'hours').format(DATETIME_FORMAT),
} : {}),
},
});
},
});

Loading…
Cancel
Save