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

@ -63,21 +63,21 @@ export async function sendReceipts({
return result;
}
const senderId = window.ConversationController.ensureContactIds({
const sender = window.ConversationController.lookupOrCreate({
e164: senderE164,
uuid: senderUuid,
});
if (!senderId) {
if (!sender) {
throw new Error(
'no conversation found with that E164/UUID. Cannot send this receipt'
);
}
const existingGroup = result.get(senderId);
const existingGroup = result.get(sender.id);
if (existingGroup) {
existingGroup.push(receipt);
} else {
result.set(senderId, [receipt]);
result.set(sender.id, [receipt]);
}
return result;