|
|
|
@ -632,33 +632,16 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|
|
|
|
[self saveGroupMessage:message inThread:thread];
|
|
|
|
|
NSMutableArray<TOCFuture *> *futures = [NSMutableArray array];
|
|
|
|
|
|
|
|
|
|
NSArray<NSString *> *blockedPhoneNumbers = _blockingManager.blockedPhoneNumbers;
|
|
|
|
|
int blockedCount = 0;
|
|
|
|
|
for (SignalRecipient *rec in recipients) {
|
|
|
|
|
// We don't need to send the message to ourselves...
|
|
|
|
|
if ([rec.uniqueId isEqualToString:[TSStorageManager localNumber]]) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// ...or to anyone on our blocklist...
|
|
|
|
|
OWSAssert(rec.uniqueId.length > 0);
|
|
|
|
|
if ([blockedPhoneNumbers containsObject:rec.uniqueId]) {
|
|
|
|
|
DDLogInfo(@"%@ skipping group send to blocked contact: %@", self.tag, rec.uniqueId);
|
|
|
|
|
blockedCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ...otherwise we send.
|
|
|
|
|
[futures addObject:[self sendMessageFuture:message recipient:rec thread:thread]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If all recipients in the group are in our blocklist,
|
|
|
|
|
// there's nothing to do.
|
|
|
|
|
if (blockedCount > 0 && futures.count == 0) {
|
|
|
|
|
NSError *error = OWSErrorMakeMessageSendFailedToBlocklistError();
|
|
|
|
|
failureHandler(error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TOCFuture *completionFuture = futures.toc_thenAll;
|
|
|
|
|
|
|
|
|
|
[completionFuture thenDo:^(id value) {
|
|
|
|
|