Fix handling CallLogEvent sync for call link targets

This commit is contained in:
ayumi-signal 2024-10-17 13:34:06 -07:00 committed by GitHub
parent 6bc2f8260b
commit bc9ced22a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 136 additions and 71 deletions

View file

@ -14,10 +14,12 @@ export async function onCallLogEventSync(
syncEvent: CallLogEventSyncEvent
): Promise<void> {
const { data, confirm } = syncEvent;
const { type, peerId, callId, timestamp } = data.callLogEventDetails;
const { type, peerIdAsConversationId, peerIdAsRoomId, callId, timestamp } =
data.callLogEventDetails;
const target: CallLogEventTarget = {
peerId,
peerIdAsConversationId,
peerIdAsRoomId,
callId,
timestamp,
};
@ -50,7 +52,8 @@ export async function onCallLogEventSync(
} else if (type === CallLogEvent.MarkedAsReadInConversation) {
log.info('onCallLogEventSync: Marking call history read in conversation');
try {
strictAssert(peerId, 'Missing peerId');
strictAssert(peerIdAsConversationId, 'Missing peerIdAsConversationId');
strictAssert(peerIdAsRoomId, 'Missing peerIdAsRoomId');
const count =
await DataWriter.markAllCallHistoryReadInConversation(target);
log.info(