|
59 | 59 | import java.util.concurrent.CancellationException;
|
60 | 60 | import java.util.concurrent.CompletableFuture;
|
61 | 61 | import java.util.concurrent.ExecutionException;
|
| 62 | +import java.util.function.Predicate; |
62 | 63 | import java.util.stream.Collectors;
|
63 | 64 | import java.util.stream.Stream;
|
64 | 65 | import javax.annotation.Nullable;
|
@@ -684,16 +685,21 @@ public Response sendMultiRecipientMessage(
|
684 | 685 | messageSender.sendMultiRecipientMessage(multiRecipientMessage, resolvedRecipients, timestamp, isStory, online, isUrgent).get();
|
685 | 686 | }
|
686 | 687 |
|
687 |
| - final List<ServiceIdentifier> unresolvedRecipientServiceIds = authType == AUTH_TYPE_GROUP_SEND_TOKEN ? new ArrayList<>() : List.of(); |
| 688 | + final List<ServiceIdentifier> unresolvedRecipientServiceIds; |
| 689 | + if (AUTH_TYPE_GROUP_SEND_TOKEN.equals(authType)) { |
| 690 | + unresolvedRecipientServiceIds = multiRecipientMessage.getRecipients().entrySet().stream() |
| 691 | + .filter(entry -> !resolvedRecipients.containsKey(entry.getValue())) |
| 692 | + .map(entry -> ServiceIdentifier.fromLibsignal(entry.getKey())) |
| 693 | + .toList(); |
| 694 | + } else { |
| 695 | + unresolvedRecipientServiceIds = List.of(); |
| 696 | + } |
688 | 697 |
|
689 | 698 | multiRecipientMessage.getRecipients().forEach((serviceId, recipient) -> {
|
690 | 699 | if (!resolvedRecipients.containsKey(recipient)) {
|
691 | 700 | // We skipped sending to this recipient because we couldn't resolve the recipient to an
|
692 | 701 | // existing account; don't increment the counter for this recipient. If the client was
|
693 | 702 | // using a GSE, track the missing recipients to include in the response.
|
694 |
| - if (authType == AUTH_TYPE_GROUP_SEND_TOKEN) { |
695 |
| - unresolvedRecipientServiceIds.add(ServiceIdentifier.fromLibsignal(serviceId)); |
696 |
| - } |
697 | 703 | return;
|
698 | 704 | }
|
699 | 705 |
|
|
0 commit comments