mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 02:08:40 +00:00
Show blocked users as 'skipped' when sending to curated story list.
This commit is contained in:
@@ -164,6 +164,7 @@ public final class PushDistributionListSendJob extends PushSendJob {
|
||||
log(TAG, String.valueOf(message.getSentTimeMillis()), "Sending message: " + messageId + ", Recipient: " + message.getRecipient().getId() + ", Attachments: " + buildAttachmentString(message.getAttachments()));
|
||||
|
||||
List<Recipient> targets;
|
||||
List<RecipientId> skipped = Collections.emptyList();
|
||||
|
||||
if (Util.hasItems(filterRecipientIds)) {
|
||||
targets = new ArrayList<>(filterRecipientIds.size() + existingNetworkFailures.size());
|
||||
@@ -172,13 +173,15 @@ public final class PushDistributionListSendJob extends PushSendJob {
|
||||
} else if (!existingNetworkFailures.isEmpty()) {
|
||||
targets = Stream.of(existingNetworkFailures).map(nf -> nf.getRecipientId(context)).distinct().map(Recipient::resolved).toList();
|
||||
} else {
|
||||
targets = Stream.of(Stories.getRecipientsToSendTo(messageId, message.getSentTimeMillis(), message.getStoryType().isStoryWithReplies())).distinctBy(Recipient::getId).toList();
|
||||
Stories.SendData data = Stories.getRecipientsToSendTo(messageId, message.getSentTimeMillis(), message.getStoryType().isStoryWithReplies());
|
||||
targets = data.getTargets();
|
||||
skipped = data.getSkipped();
|
||||
}
|
||||
|
||||
List<SendMessageResult> results = deliver(message, targets);
|
||||
Log.i(TAG, JobLogger.format(this, "Finished send."));
|
||||
|
||||
PushGroupSendJob.processGroupMessageResults(context, messageId, -1, null, message, results, targets, Collections.emptyList(), existingNetworkFailures, existingIdentityMismatches);
|
||||
PushGroupSendJob.processGroupMessageResults(context, messageId, -1, null, message, results, targets, skipped, existingNetworkFailures, existingIdentityMismatches);
|
||||
|
||||
} catch (UntrustedIdentityException | UndeliverableMessageException e) {
|
||||
warn(TAG, String.valueOf(message.getSentTimeMillis()), e);
|
||||
|
||||
@@ -89,10 +89,12 @@ object Stories {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getRecipientsToSendTo(messageId: Long, sentTimestamp: Long, allowsReplies: Boolean): List<Recipient> {
|
||||
fun getRecipientsToSendTo(messageId: Long, sentTimestamp: Long, allowsReplies: Boolean): SendData {
|
||||
val recipientIds: List<RecipientId> = SignalDatabase.storySends.getRecipientsToSendTo(messageId, sentTimestamp, allowsReplies)
|
||||
val targets: List<Recipient> = RecipientUtil.getEligibleForSending(recipientIds.map(Recipient::resolved)).distinctBy { it.id }
|
||||
val skipped: List<RecipientId> = (recipientIds.toSet() - targets.map { it.id }.toSet()).toList()
|
||||
|
||||
return RecipientUtil.getEligibleForSending(recipientIds.map(Recipient::resolved))
|
||||
return SendData(targets, skipped)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@@ -398,4 +400,9 @@ object Stories {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class SendData(
|
||||
val targets: List<Recipient>,
|
||||
val skipped: List<RecipientId>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user