Passive UUID support

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Ken Powers 2020-03-05 13:14:58 -08:00 committed by Scott Nonnenberg
parent f64ca0ed21
commit a90246cbe5
49 changed files with 2226 additions and 776 deletions

View file

@ -5,6 +5,7 @@
'use strict';
const BLOCKED_NUMBERS_ID = 'blocked';
const BLOCKED_UUIDS_ID = 'blocked-uuids';
const BLOCKED_GROUPS_ID = 'blocked-groups';
storage.isBlocked = number => {
@ -31,6 +32,30 @@
storage.put(BLOCKED_NUMBERS_ID, _.without(numbers, number));
};
storage.isUuidBlocked = uuid => {
const uuids = storage.get(BLOCKED_UUIDS_ID, []);
return _.include(uuids, uuid);
};
storage.addBlockedUuid = uuid => {
const uuids = storage.get(BLOCKED_UUIDS_ID, []);
if (_.include(uuids, uuid)) {
return;
}
window.log.info('adding', uuid, 'to blocked list');
storage.put(BLOCKED_UUIDS_ID, uuids.concat(uuid));
};
storage.removeBlockedUuid = uuid => {
const numbers = storage.get(BLOCKED_UUIDS_ID, []);
if (!_.include(numbers, uuid)) {
return;
}
window.log.info('removing', uuid, 'from blocked list');
storage.put(BLOCKED_NUMBERS_ID, _.without(numbers, uuid));
};
storage.isGroupBlocked = groupId => {
const groupIds = storage.get(BLOCKED_GROUPS_ID, []);