signal-desktop/js/models/blockedNumbers.js

27 lines
708 B
JavaScript
Raw Normal View History

2018-04-27 21:25:04 +00:00
(function() {
'use strict';
storage.isBlocked = function(number) {
var numbers = storage.get('blocked', []);
2018-04-27 21:25:04 +00:00
return _.include(numbers, number);
};
storage.addBlockedNumber = function(number) {
var numbers = storage.get('blocked', []);
if (_.include(numbers, number)) {
return;
}
2018-04-27 21:25:04 +00:00
console.log('adding', number, 'to blocked list');
storage.put('blocked', numbers.concat(number));
};
storage.removeBlockedNumber = function(number) {
var numbers = storage.get('blocked', []);
if (!_.include(numbers, number)) {
return;
}
2018-04-27 21:25:04 +00:00
console.log('removing', number, 'from blocked list');
storage.put('blocked', _.without(numbers, number));
};
})();