Early preparations for PNP Contact Merging

This commit is contained in:
Scott Nonnenberg 2022-08-09 14:39:00 -07:00 committed by GitHub
parent 2f5dd73e58
commit faf6c41332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 1572 additions and 447 deletions

View file

@ -58,13 +58,13 @@ export class ReadSyncs extends Collection {
}
forMessage(message: MessageModel): ReadSyncModel | null {
const senderId = window.ConversationController.ensureContactIds({
const sender = window.ConversationController.lookupOrCreate({
e164: message.get('source'),
uuid: message.get('sourceUuid'),
});
const sync = this.find(item => {
return (
item.get('senderId') === senderId &&
item.get('senderId') === sender?.id &&
item.get('timestamp') === message.get('sent_at')
);
});
@ -84,12 +84,12 @@ export class ReadSyncs extends Collection {
);
const found = messages.find(item => {
const senderId = window.ConversationController.ensureContactIds({
const sender = window.ConversationController.lookupOrCreate({
e164: item.source,
uuid: item.sourceUuid,
});
return isIncoming(item) && senderId === sync.get('senderId');
return isIncoming(item) && sender?.id === sync.get('senderId');
});
if (!found) {