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

@ -282,10 +282,14 @@ const callLogEventFromProto: Partial<
export function getCallLogEventForProto(
callLogEventProto: Proto.SyncMessage.ICallLogEvent
): CallLogEventDetails {
const callLogEvent = parsePartial(
callLogEventNormalizeSchema,
callLogEventProto
);
// CallLogEvent peerId is ambiguous whether it's a conversationId (direct, or groupId)
// or roomId so handle both cases
const { peerId: peerIdBytes } = callLogEventProto;
const callLogEvent = parsePartial(callLogEventNormalizeSchema, {
...callLogEventProto,
peerIdAsConversationId: peerIdBytes,
peerIdAsRoomId: peerIdBytes,
});
const type = callLogEventFromProto[callLogEvent.type];
if (type == null) {
@ -295,7 +299,8 @@ export function getCallLogEventForProto(
return {
type,
timestamp: callLogEvent.timestamp,
peerId: callLogEvent.peerId ?? null,
peerIdAsConversationId: callLogEvent.peerIdAsConversationId ?? null,
peerIdAsRoomId: callLogEvent.peerIdAsRoomId ?? null,
callId: callLogEvent.callId ?? null,
};
}