diff --git a/SessionMessagingKit/Database/Storage+Messaging.swift b/SessionMessagingKit/Database/Storage+Messaging.swift index 6d47c3a98..041e1b0f1 100644 --- a/SessionMessagingKit/Database/Storage+Messaging.swift +++ b/SessionMessagingKit/Database/Storage+Messaging.swift @@ -31,7 +31,17 @@ extension Storage { let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) else { return nil } let tsMessage: TSMessage if message.sender == getUserPublicKey() { - tsMessage = TSOutgoingMessage.from(message, associatedWith: thread, using: transaction) + let tsOutgoingMessage = TSOutgoingMessage.from(message, associatedWith: thread, using: transaction) + var recipients: [String] = [] + if let syncTarget = message.syncTarget { + recipients.append(syncTarget) + } else if let thread = thread as? TSGroupThread, thread.isClosedGroup { + recipients = thread.groupModel.groupMemberIds + } + recipients.forEach { recipient in + tsOutgoingMessage.update(withSentRecipient: recipient, wasSentByUD: true, transaction: transaction) + } + tsMessage = tsOutgoingMessage } else { tsMessage = TSIncomingMessage.from(message, quotedMessage: quotedMessage, linkPreview: linkPreview, associatedWith: thread) }