From b79244affaedd35e10112387f724e1ea8dde4519 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 23 Feb 2018 11:19:21 -0500 Subject: [PATCH] Don't enqueue sender read receipts from self-sent messages These messages are always already read. Reminder, there are two types of read receipts: 1. One informs our linked devices that we've read a message on another device. 2. The other informs the sender that we've read their message. This change is about the latter, we'll continue to send the former to ourself. The proximate cause for this change was a failing assert in OWSMessageSender#handleSendToMyself:(TSOutgoingMessage *)outgoingMessage The assert was failing because we were sending a message to ourself which had no body or attachment (the sender-read receipt). Rather than filtering them out from the message sender, we should never ask the message sender to do nonsense work (send a senderReadReceipt to ourself) // FREEBIE --- SignalServiceKit/src/Messages/OWSReadReceiptManager.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SignalServiceKit/src/Messages/OWSReadReceiptManager.m b/SignalServiceKit/src/Messages/OWSReadReceiptManager.m index 97dc644a8..c4db912f4 100644 --- a/SignalServiceKit/src/Messages/OWSReadReceiptManager.m +++ b/SignalServiceKit/src/Messages/OWSReadReceiptManager.m @@ -12,6 +12,7 @@ #import "OWSSignalServiceProtos.pb.h" #import "OWSStorage.h" #import "OWSSyncConfigurationMessage.h" +#import "TSAccountManager.h" #import "TSContactThread.h" #import "TSDatabaseView.h" #import "TSIncomingMessage.h" @@ -318,6 +319,11 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE self.toLinkedDevicesReadReceiptMap[threadUniqueId] = newReadReceipt; } + if ([message.messageAuthorId isEqualToString:[TSAccountManager localNumber]]) { + DDLogVerbose(@"%@ Ignoring read receipt for self-sender.", self.logTag); + return; + } + if ([self areReadReceiptsEnabled]) { DDLogVerbose(@"%@ Enqueuing read receipt for sender.", self.logTag); NSMutableSet *_Nullable timestamps = self.toSenderReadReceiptMap[messageAuthorId];