Migrate schema to service ids
This commit is contained in:
parent
71958f8a01
commit
8b0da36caa
258 changed files with 4795 additions and 2613 deletions
|
@ -28,7 +28,7 @@ export function forMessage(
|
|||
| 'editMessageTimestamp'
|
||||
| 'sent_at'
|
||||
| 'source'
|
||||
| 'sourceUuid'
|
||||
| 'sourceServiceId'
|
||||
| 'timestamp'
|
||||
| 'type'
|
||||
>
|
||||
|
|
|
@ -23,7 +23,7 @@ import {
|
|||
import type { DeleteSentProtoRecipientOptionsType } from '../sql/Interface';
|
||||
import dataInterface from '../sql/Client';
|
||||
import * as log from '../logging/log';
|
||||
import { getSourceUuid } from '../messages/helpers';
|
||||
import { getSourceServiceId } from '../messages/helpers';
|
||||
import { queueUpdateMessage } from '../util/messageBatcher';
|
||||
import { getMessageSentTimestamp } from '../util/getMessageSentTimestamp';
|
||||
|
||||
|
@ -61,8 +61,8 @@ const deleteSentProtoBatcher = createWaitBatcher({
|
|||
items
|
||||
);
|
||||
|
||||
for (const uuid of successfulPhoneNumberShares) {
|
||||
const convo = window.ConversationController.get(uuid);
|
||||
for (const serviceId of successfulPhoneNumberShares) {
|
||||
const convo = window.ConversationController.get(serviceId);
|
||||
if (!convo) {
|
||||
continue;
|
||||
}
|
||||
|
@ -158,8 +158,8 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
|||
}
|
||||
|
||||
const ourAci = window.textsecure.storage.user.getCheckedAci();
|
||||
const sourceUuid = getSourceUuid(message.attributes);
|
||||
if (ourAci !== sourceUuid) {
|
||||
const sourceServiceId = getSourceServiceId(message.attributes);
|
||||
if (ourAci !== sourceServiceId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
|||
]);
|
||||
} else {
|
||||
log.warn(
|
||||
`MessageReceipts.onReceipt: Missing uuid or deviceId for deliveredTo ${sourceConversationId}`
|
||||
`MessageReceipts.onReceipt: Missing serviceId or deviceId for deliveredTo ${sourceConversationId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,16 +43,16 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
}
|
||||
}
|
||||
|
||||
if (conversation.get('uuid')) {
|
||||
const syncByUuid = this.findWhere({
|
||||
threadAci: conversation.get('uuid'),
|
||||
if (conversation.getServiceId()) {
|
||||
const syncByAci = this.findWhere({
|
||||
threadAci: conversation.getServiceId(),
|
||||
});
|
||||
if (syncByUuid) {
|
||||
if (syncByAci) {
|
||||
log.info(
|
||||
`Found early message request response for UUID ${conversation.idForLogging()}`
|
||||
`Found early message request response for aci ${conversation.idForLogging()}`
|
||||
);
|
||||
this.remove(syncByUuid);
|
||||
return syncByUuid;
|
||||
this.remove(syncByAci);
|
||||
return syncByAci;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
if (!conversation && (threadE164 || threadAci)) {
|
||||
conversation = window.ConversationController.lookupOrCreate({
|
||||
e164: threadE164,
|
||||
uuid: threadAci,
|
||||
serviceId: threadAci,
|
||||
reason: 'MessageRequests.onResponse',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export class Reactions extends Collection<ReactionModel> {
|
|||
const senderId = getContactId(message.attributes);
|
||||
const reactionsBySource = this.filter(re => {
|
||||
const targetSender = window.ConversationController.lookupOrCreate({
|
||||
uuid: re.get('targetAuthorUuid'),
|
||||
serviceId: re.get('targetAuthorAci'),
|
||||
reason: 'Reactions.forMessage',
|
||||
});
|
||||
const targetTimestamp = re.get('targetTimestamp');
|
||||
|
@ -92,7 +92,7 @@ export class Reactions extends Collection<ReactionModel> {
|
|||
// to to figure that out.
|
||||
const targetAuthorConversation =
|
||||
window.ConversationController.lookupOrCreate({
|
||||
uuid: reaction.get('targetAuthorUuid'),
|
||||
serviceId: reaction.get('targetAuthorAci'),
|
||||
reason: 'Reactions.onReaction',
|
||||
});
|
||||
const targetConversationId = targetAuthorConversation?.id;
|
||||
|
@ -122,7 +122,7 @@ export class Reactions extends Collection<ReactionModel> {
|
|||
'No message for reaction',
|
||||
reaction.get('timestamp'),
|
||||
'targeting',
|
||||
reaction.get('targetAuthorUuid'),
|
||||
reaction.get('targetAuthorAci'),
|
||||
reaction.get('targetTimestamp')
|
||||
);
|
||||
|
||||
|
@ -147,7 +147,7 @@ export class Reactions extends Collection<ReactionModel> {
|
|||
if (!targetConversation) {
|
||||
log.info(
|
||||
'No target conversation for reaction',
|
||||
reaction.get('targetAuthorUuid'),
|
||||
reaction.get('targetAuthorAci'),
|
||||
reaction.get('targetTimestamp')
|
||||
);
|
||||
return undefined;
|
||||
|
|
|
@ -48,7 +48,7 @@ async function maybeItIsAReactionReadSync(sync: ReadSyncModel): Promise<void> {
|
|||
notificationService.removeBy({
|
||||
conversationId: readReaction.conversationId,
|
||||
emoji: readReaction.emoji,
|
||||
targetAuthorUuid: readReaction.targetAuthorUuid,
|
||||
targetAuthorAci: readReaction.targetAuthorAci,
|
||||
targetTimestamp: readReaction.targetTimestamp,
|
||||
});
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export class ReadSyncs extends Collection {
|
|||
forMessage(message: MessageModel): ReadSyncModel | null {
|
||||
const sender = window.ConversationController.lookupOrCreate({
|
||||
e164: message.get('source'),
|
||||
uuid: message.get('sourceUuid'),
|
||||
serviceId: message.get('sourceServiceId'),
|
||||
reason: 'ReadSyncs.forMessage',
|
||||
});
|
||||
const messageTimestamp = getMessageSentTimestamp(message.attributes, {
|
||||
|
@ -95,7 +95,7 @@ export class ReadSyncs extends Collection {
|
|||
const found = messages.find(item => {
|
||||
const sender = window.ConversationController.lookupOrCreate({
|
||||
e164: item.source,
|
||||
uuid: item.sourceUuid,
|
||||
serviceId: item.sourceServiceId,
|
||||
reason: 'ReadSyncs.onSync',
|
||||
});
|
||||
|
||||
|
|
|
@ -29,16 +29,16 @@ export class ViewOnceOpenSyncs extends Collection<ViewOnceOpenSyncModel> {
|
|||
}
|
||||
|
||||
forMessage(message: MessageModel): ViewOnceOpenSyncModel | null {
|
||||
const syncBySourceUuid = this.find(item => {
|
||||
const syncBySourceAci = this.find(item => {
|
||||
return (
|
||||
item.get('sourceAci') === message.get('sourceUuid') &&
|
||||
item.get('sourceAci') === message.get('sourceServiceId') &&
|
||||
item.get('timestamp') === message.get('sent_at')
|
||||
);
|
||||
});
|
||||
if (syncBySourceUuid) {
|
||||
if (syncBySourceAci) {
|
||||
log.info('Found early view once open sync for message');
|
||||
this.remove(syncBySourceUuid);
|
||||
return syncBySourceUuid;
|
||||
this.remove(syncBySourceAci);
|
||||
return syncBySourceAci;
|
||||
}
|
||||
|
||||
const syncBySource = this.find(item => {
|
||||
|
@ -63,7 +63,7 @@ export class ViewOnceOpenSyncs extends Collection<ViewOnceOpenSyncModel> {
|
|||
);
|
||||
|
||||
const found = messages.find(item => {
|
||||
const itemSourceAci = item.sourceUuid;
|
||||
const itemSourceAci = item.sourceServiceId;
|
||||
const syncSourceAci = sync.get('sourceAci');
|
||||
const itemSource = item.source;
|
||||
const syncSource = sync.get('source');
|
||||
|
|
|
@ -43,7 +43,7 @@ export class ViewSyncs extends Collection {
|
|||
forMessage(message: MessageModel): Array<ViewSyncModel> {
|
||||
const sender = window.ConversationController.lookupOrCreate({
|
||||
e164: message.get('source'),
|
||||
uuid: message.get('sourceUuid'),
|
||||
serviceId: message.get('sourceServiceId'),
|
||||
reason: 'ViewSyncs.forMessage',
|
||||
});
|
||||
const messageTimestamp = getMessageSentTimestamp(message.attributes, {
|
||||
|
@ -73,7 +73,7 @@ export class ViewSyncs extends Collection {
|
|||
const found = messages.find(item => {
|
||||
const sender = window.ConversationController.lookupOrCreate({
|
||||
e164: item.source,
|
||||
uuid: item.sourceUuid,
|
||||
serviceId: item.sourceServiceId,
|
||||
reason: 'ViewSyncs.onSync',
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue