From da56c2790f477c05e858cb08e1fb1b1bbc8f1fa3 Mon Sep 17 00:00:00 2001 From: Alan Evans Date: Wed, 24 Feb 2021 17:04:29 -0400 Subject: [PATCH] Ensure no typing indicators can be sent to self or blocked recipients. --- .../thoughtcrime/securesms/jobs/TypingSendJob.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/TypingSendJob.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/TypingSendJob.java index 15b9983e99..391b3e1356 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/TypingSendJob.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/TypingSendJob.java @@ -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 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> 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;