diff --git a/SessionMessagingKit/Open Groups/OpenGroupMessage+Conversion.swift b/SessionMessagingKit/Open Groups/OpenGroupMessage+Conversion.swift index 1c2eac258..1c3b0d207 100644 --- a/SessionMessagingKit/Open Groups/OpenGroupMessage+Conversion.swift +++ b/SessionMessagingKit/Open Groups/OpenGroupMessage+Conversion.swift @@ -11,16 +11,12 @@ internal extension OpenGroupMessage { let quote: OpenGroupMessage.Quote? = { if let quote = message.quote { guard quote.isValid else { return nil } - var quotedMessageServerID: UInt64? - TSDatabaseSecondaryIndexes.enumerateMessages(withTimestamp: quote.timestamp!, with: { _, key, _ in - guard let message = TSInteraction.fetch(uniqueId: key, transaction: transaction) as? TSMessage else { return } - quotedMessageServerID = message.openGroupServerMessageID - }, using: transaction) let quotedMessageBody = quote.text ?? String(quote.timestamp!) // The back-end doesn't accept messages without a body so we use this as a workaround if let quotedAttachmentID = quote.attachmentID, let index = attachmentIDs.firstIndex(of: quotedAttachmentID) { attachmentIDs.remove(at: index) } - return OpenGroupMessage.Quote(quotedMessageTimestamp: quote.timestamp!, quoteePublicKey: quote.publicKey!, quotedMessageBody: quotedMessageBody, quotedMessageServerID: quotedMessageServerID) + // FIXME: For some reason the server always returns a 500 if quotedMessageServerID is set... + return OpenGroupMessage.Quote(quotedMessageTimestamp: quote.timestamp!, quoteePublicKey: quote.publicKey!, quotedMessageBody: quotedMessageBody, quotedMessageServerID: nil) } else { return nil } diff --git a/SessionMessagingKit/Sending & Receiving/MessageSender.swift b/SessionMessagingKit/Sending & Receiving/MessageSender.swift index 2813d5a69..4d20bc111 100644 --- a/SessionMessagingKit/Sending & Receiving/MessageSender.swift +++ b/SessionMessagingKit/Sending & Receiving/MessageSender.swift @@ -246,7 +246,9 @@ public final class MessageSender : NSObject { internal static func sendToOpenGroupDestination(_ destination: Message.Destination, message: Message, using transaction: Any) -> Promise { let (promise, seal) = Promise.pending() let storage = Configuration.shared.storage - message.sentTimestamp = NSDate.millisecondTimestamp() + if message.sentTimestamp == nil { // Visible messages will already have their sent timestamp set + message.sentTimestamp = NSDate.millisecondTimestamp() + } message.sender = storage.getUserPublicKey() switch destination { case .contact(_): preconditionFailure()