exclude our local device from synced contact

pull/1137/head
Audric Ackermann 6 years ago
parent 70990a60ba
commit 21702d117a
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -694,21 +694,27 @@ MessageSender.prototype = {
); );
}) })
)) || []; )) || [];
// filter out our primary pubkey if it was added.
sessionContactsSecondary = sessionContactsSecondary.filter(c => c.id !== primaryDeviceKey);
const contactsSet = new Set([ const contactsSet = new Set([
...sessionContactsPrimary, ...sessionContactsPrimary,
...sessionContactsSecondary, ...sessionContactsSecondary,
]); ]);
const contacts = [...contactsSet];
if (contacts.length === 0) { if (contactsSet.size === 0) {
window.console.info('No contacts to sync.'); window.console.info('No contacts to sync.');
return Promise.resolve(); return Promise.resolve();
} }
libloki.api.debug.logContactSync(
'Triggering contact sync message with:',
[...contactsSet]
);
// We need to sync across 3 contacts at a time // We need to sync across 3 contacts at a time
// This is to avoid hitting storage server limit // This is to avoid hitting storage server limit
const chunked = _.chunk(contacts, 3); const chunked = _.chunk(contactsSet, 3);
const syncMessages = await Promise.all( const syncMessages = await Promise.all(
chunked.map(c => libloki.api.createContactSyncProtoMessage(c)) chunked.map(c => libloki.api.createContactSyncProtoMessage(c))
); );

Loading…
Cancel
Save