Migrate schema to service ids

This commit is contained in:
Fedor Indutny 2023-08-16 22:54:39 +02:00 committed by Jamie Kyle
parent 71958f8a01
commit 8b0da36caa
258 changed files with 4795 additions and 2613 deletions

View file

@ -5,16 +5,20 @@ import type {
ConversationAttributesType,
MessageAttributesType,
} from '../model-types.d';
import { getSource, getSourceDevice, getSourceUuid } from '../messages/helpers';
import {
getSource,
getSourceDevice,
getSourceServiceId,
} from '../messages/helpers';
import { isDirectConversation, isGroupV2 } from './whatTypeOfConversation';
export function getMessageIdForLogging(
message: Pick<
MessageAttributesType,
'type' | 'sourceUuid' | 'sourceDevice' | 'sent_at'
'type' | 'sourceServiceId' | 'sourceDevice' | 'sent_at'
>
): string {
const account = getSourceUuid(message) || getSource(message);
const account = getSourceServiceId(message) || getSource(message);
const device = getSourceDevice(message);
const timestamp = message.sent_at;
@ -25,8 +29,8 @@ export function getConversationIdForLogging(
conversation: ConversationAttributesType
): string {
if (isDirectConversation(conversation)) {
const { uuid, e164, id } = conversation;
return `${uuid || e164} (${id})`;
const { serviceId, pni, e164, id } = conversation;
return `${serviceId || pni || e164} (${id})`;
}
if (isGroupV2(conversation)) {
return `groupv2(${conversation.groupId})`;