Ensure no typing indicators can be sent to self or blocked recipients.

This commit is contained in:
Alan Evans
2021-02-24 17:04:29 -04:00
committed by GitHub
parent 687192f071
commit da56c2790f

View File

@@ -92,6 +92,12 @@ public class TypingSendJob extends BaseJob {
if (recipient.isBlocked()) {
Log.w(TAG, "Not sending typing indicators to blocked recipients.");
return;
}
if (recipient.isSelf()) {
Log.w(TAG, "Not sending typing indicators to self.");
return;
}
List<Recipient> recipients = Collections.singletonList(recipient);
@@ -104,6 +110,7 @@ public class TypingSendJob extends BaseJob {
recipients = RecipientUtil.getEligibleForSending(Stream.of(recipients)
.map(Recipient::resolve)
.filter(r -> !r.isBlocked())
.toList());
SignalServiceMessageSender messageSender = ApplicationDependencies.getSignalServiceMessageSender();
@@ -111,6 +118,11 @@ public class TypingSendJob extends BaseJob {
List<Optional<UnidentifiedAccessPair>> unidentifiedAccess = UnidentifiedAccessUtil.getAccessFor(context, recipients);
SignalServiceTypingMessage typingMessage = new SignalServiceTypingMessage(typing ? Action.STARTED : Action.STOPPED, System.currentTimeMillis(), groupId);
if (addresses.isEmpty()) {
Log.w(TAG, "No one to send typing indicators to");
return;
}
if (isCanceled()) {
Log.w(TAG, "Canceled before send!");
return;