fix(HH-576): normalize realtime message timestamps (#148)
Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
import { ON_CONVERSATION_CREATED } from 'widget/constants/widgetBusEvents';
|
||||
import { createTemporaryMessage, getNonDeletedMessages } from './helpers';
|
||||
import { emitter } from 'shared/helpers/mitt';
|
||||
import { isNewerTimestamp } from 'shared/helpers/timeHelper';
|
||||
export const actions = {
|
||||
createConversation: async ({ commit, dispatch }, params) => {
|
||||
commit('setConversationUIFlag', { isCreating: true });
|
||||
@@ -178,9 +179,8 @@ export const actions = {
|
||||
const currentMessage = state?.conversations?.[id];
|
||||
const isNew = !currentMessage;
|
||||
if (
|
||||
currentMessage?.updated_at &&
|
||||
data.updated_at &&
|
||||
data.updated_at <= currentMessage.updated_at
|
||||
currentMessage &&
|
||||
!isNewerTimestamp(currentMessage.updated_at, data.updated_at)
|
||||
) {
|
||||
return { applied: false, isNew };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user