Bugfix: Use server timestamp to set agent_last_seen_at (#1114)
This commit is contained in:
@@ -170,11 +170,18 @@ const actions = {
|
||||
},
|
||||
|
||||
markMessagesRead: async ({ commit }, data) => {
|
||||
setTimeout(() => {
|
||||
commit(types.default.MARK_MESSAGE_READ, data);
|
||||
}, 4000);
|
||||
try {
|
||||
await ConversationApi.markMessageRead(data);
|
||||
const {
|
||||
data: { id, agent_last_seen_at: lastSeen },
|
||||
} = await ConversationApi.markMessageRead(data);
|
||||
setTimeout(
|
||||
() =>
|
||||
commit(types.default.MARK_MESSAGE_READ, {
|
||||
id,
|
||||
lastSeen,
|
||||
}),
|
||||
4000
|
||||
);
|
||||
} catch (error) {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
@@ -134,7 +134,9 @@ export const mutations = {
|
||||
|
||||
[types.default.MARK_MESSAGE_READ](_state, { id, lastSeen }) {
|
||||
const [chat] = _state.allConversations.filter(c => c.id === id);
|
||||
chat.agent_last_seen_at = lastSeen;
|
||||
if (chat) {
|
||||
chat.agent_last_seen_at = lastSeen;
|
||||
}
|
||||
},
|
||||
|
||||
[types.default.CHANGE_CHAT_STATUS_FILTER](_state, data) {
|
||||
|
||||
Reference in New Issue
Block a user