|
@@ -37,7 +37,7 @@ function chatReducer(state = {}, { type, chat_id, title, createdAt, lastModified
|
|
|
[chat_id]: {
|
|
|
title: state[chat_id].title,
|
|
|
createdAt: state[chat_id].createdAt,
|
|
|
- lastModified: msg_createdAt,
|
|
|
+ lastModified: state[chat_id].lastModified > msg_createdAt ? state[chat_id].lastModified : msg_createdAt,
|
|
|
avatar: state[chat_id].avatar,
|
|
|
messages: socket ? [...state[chat_id].messages, { _id: msg_id, text: msg_text, createdAt: msg_createdAt, owner: msg_owner, media: msg_media, replyTo: msg_replyTo }] : [{ _id: msg_id, text: msg_text, createdAt: msg_createdAt, owner: msg_owner, media: msg_media, replyTo: msg_replyTo }, ...state[chat_id].messages],
|
|
|
members: state[chat_id].members
|
|
@@ -63,7 +63,7 @@ function chatReducer(state = {}, { type, chat_id, title, createdAt, lastModified
|
|
|
[chat_id]: {
|
|
|
title: state[chat_id].title,
|
|
|
createdAt: state[chat_id].createdAt,
|
|
|
- lastModified: state[chat_id.createdAt],
|
|
|
+ lastModified: state[chat_id].lastModified,
|
|
|
avatar: state[chat_id].avatar,
|
|
|
messages: newMessages,
|
|
|
members: state[chat_id].members
|