Use uuidv7 in callDisposition

This commit is contained in:
Fedor Indutny 2024-10-16 13:03:45 -07:00 committed by GitHub
parent ab87c815c9
commit 32f9f489c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,13 +11,13 @@ import {
callIdFromRingId,
RingUpdate,
} from '@signalapp/ringrtc';
import { v4 as generateGuid } from 'uuid';
import { isEqual } from 'lodash';
import { strictAssert } from './assert';
import { DataReader, DataWriter } from '../sql/Client';
import { SignalService as Proto } from '../protobuf';
import { bytesToUuid, uuidToBytes } from './uuidToBytes';
import { missingCaseError } from './missingCaseError';
import { generateMessageId } from './generateMessageId';
import { CallEndedReason, GroupCallJoinState } from '../types/Calling';
import {
CallMode,
@ -1212,16 +1212,18 @@ async function saveCallHistory({
seenStatus = maxSeenStatus(seenStatus, prevMessage.seenStatus);
}
const counter =
prevMessage?.received_at ?? receivedAtCounter ?? incrementMessageCounter();
const { id: newId } = generateMessageId(counter);
const message: MessageAttributesType = {
id: prevMessage?.id ?? generateGuid(),
id: prevMessage?.id ?? newId,
conversationId: conversation.id,
type: 'call-history',
timestamp: prevMessage?.timestamp ?? callHistory.timestamp,
sent_at: prevMessage?.sent_at ?? callHistory.timestamp,
received_at:
prevMessage?.received_at ??
receivedAtCounter ??
incrementMessageCounter(),
received_at: counter,
received_at_ms:
prevMessage?.received_at_ms ?? receivedAtMS ?? callHistory.timestamp,
readStatus: ReadStatus.Read,