diff --git a/SessionMessagingKit/Shared Models/MessageViewModel.swift b/SessionMessagingKit/Shared Models/MessageViewModel.swift index 753c50078..367e645e8 100644 --- a/SessionMessagingKit/Shared Models/MessageViewModel.swift +++ b/SessionMessagingKit/Shared Models/MessageViewModel.swift @@ -584,6 +584,7 @@ public extension MessageViewModel { let disappearingMessagesConfig: TypedTableAlias = TypedTableAlias() let profile: TypedTableAlias = TypedTableAlias() let quote: TypedTableAlias = TypedTableAlias() + let interactionAttachment: TypedTableAlias = TypedTableAlias() let linkPreview: TypedTableAlias = TypedTableAlias() let threadProfileTableLiteral: SQL = SQL(stringLiteral: "threadProfile") @@ -661,12 +662,13 @@ public extension MessageViewModel { \(quote[.authorId]), \(quote[.timestampMs]), \(interaction[.body]) AS \(Quote.Columns.body), - \(quote[.attachmentId]) + \(interactionAttachment[.attachmentId]) AS \(Quote.Columns.attachmentId) FROM \(Quote.self) LEFT JOIN \(Interaction.self) ON ( \(quote[.authorId]) = \(interaction[.authorId]) AND \(quote[.timestampMs]) = \(interaction[.timestampMs]) ) + LEFT JOIN \(InteractionAttachment.self) ON \(interaction[.id]) = \(interactionAttachment[.interactionId]) ) AS \(ViewModel.quoteKey) ON \(quote[.interactionId]) = \(interaction[.id]) LEFT JOIN \(Attachment.self) AS \(ViewModel.quoteAttachmentKey) ON \(ViewModel.quoteAttachmentKey).\(attachmentIdColumnLiteral) = \(quote[.attachmentId]) LEFT JOIN \(LinkPreview.self) ON (