Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix forward messages not showing #5836

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
version = "1.7">
version = "1.8">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
Expand Down
5 changes: 5 additions & 0 deletions SignalServiceKit/Messages/MessageReceiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2103,9 +2103,14 @@ class MessageReceiverRequest {
}

private static func isDuplicate(_ decryptedEnvelope: DecryptedIncomingEnvelope, tx: SDSAnyReadTransaction) -> Bool {
guard let serverGuid = decryptedEnvelope.envelope.serverGuid else {
return true
}

return InteractionFinder.existsIncomingMessage(
timestamp: decryptedEnvelope.timestamp,
sourceAci: decryptedEnvelope.sourceAci,
serverGuid: serverGuid,
transaction: tx
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ public class InteractionFinder: NSObject {
public class func existsIncomingMessage(
timestamp: UInt64,
sourceAci: Aci,
serverGuid: String
transaction: SDSAnyReadTransaction
) -> Bool {
let sql = """
SELECT EXISTS(
SELECT 1
FROM \(InteractionRecord.databaseTableName)
WHERE \(interactionColumn: .timestamp) = ?
AND \(interactionColumn: .serverGuid) = ?
AND (
\(interactionColumn: .authorUUID) = ?
OR (
Expand All @@ -67,6 +69,7 @@ public class InteractionFinder: NSObject {
let arguments: StatementArguments = [
timestamp,
sourceAci.serviceIdUppercaseString,
serverGuid,
SignalServiceAddress(sourceAci).phoneNumber
]
do {
Expand Down