filter convos to block sync by getting list from BlockedNumberController

pull/1277/head
Audric Ackermann 5 years ago
parent 401c37c39e
commit 38724d0992
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -463,9 +463,10 @@ MessageSender.prototype = {
const convos = window.getConversations().models;
const conversations = Array.isArray(convos) ? convos : [convos];
const currentlyBlockedNumbers = window.BlockedNumberController.getBlockedNumbers();
const blockedConvos = await libsession.Utils.SyncMessageUtils.filterBlockedNumbers(
conversations
const blockedConvos = conversations.filter(
c => c.isPrivate() && currentlyBlockedNumbers.includes(c.id)
);
// currently we only sync user blocked, not groups
const blockedSyncMessage = new libsession.Messages.Outgoing.BlockedListSyncMessage(

@ -95,20 +95,6 @@ export async function filterOpenGroupsConvos(
);
}
export async function filterBlockedNumbers(
conversations: Array<any>
): Promise<any> {
// If we haven't got a primaryDeviceKey then we are in the middle of pairing
// primaryDevicePubKey is set to our own number if we are the master device
const thisDevice = await UserUtil.getCurrentDevicePubKey();
if (!thisDevice) {
return [];
}
return conversations.filter(c => c.isBlocked() && c.isPrivate());
}
// Serialise as <Element0.length><Element0><Element1.length><Element1>...
// This is an implementation of the reciprocal of contacts_parser.js
export function serialiseByteBuffers(buffers: Array<Uint8Array>): ByteBuffer {

Loading…
Cancel
Save