From 6565c3fe73b5dad9695d5ae20c5360045c3ec578 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Fri, 12 Aug 2022 11:46:28 +1000 Subject: [PATCH] feat: quotes refer to original attachments. --- SessionMessagingKit/Shared Models/MessageViewModel.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 (