diff --git a/libsession/src/main/java/org/session/libsession/messaging/opengroups/OpenGroupMessage.kt b/libsession/src/main/java/org/session/libsession/messaging/opengroups/OpenGroupMessage.kt index cc8cff5b1..221c47916 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/opengroups/OpenGroupMessage.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/opengroups/OpenGroupMessage.kt @@ -26,7 +26,6 @@ data class OpenGroupMessage( fun from(message: VisibleMessage, server: String): OpenGroupMessage? { val storage = MessagingConfiguration.shared.storage val userPublicKey = storage.getUserPublicKey() ?: return null - var attachmentIDs = message.attachmentIDs // Validation if (!message.isValid()) { return null } // Should be valid at this point // Quote @@ -34,8 +33,6 @@ data class OpenGroupMessage( val quote = message.quote if (quote != null && quote.isValid()) { val quotedMessageBody = quote.text ?: quote.timestamp!!.toString() - val quotedAttachmentID = quote.attachmentID - if (quotedAttachmentID != null) { attachmentIDs.remove(quotedAttachmentID) } // FIXME: For some reason the server always returns a 500 if quotedMessageServerID is set... Quote(quote.timestamp!!, quote.publicKey!!, quotedMessageBody, null) } else { @@ -51,18 +48,18 @@ data class OpenGroupMessage( linkPreview?.let { if (!linkPreview.isValid()) { return@let } val attachmentID = linkPreview.attachmentID ?: return@let - val attachment = MessagingConfiguration.shared.messageDataProvider.getAttachmentPointer(attachmentID) ?: return@let + val attachment = MessagingConfiguration.shared.messageDataProvider.getSignalAttachmentPointer(attachmentID) ?: return@let val openGroupLinkPreview = Attachment( Attachment.Kind.LinkPreview, server, attachment.id, attachment.contentType!!, attachment.size.get(), - attachment.fileName.get(), + attachment.fileName.orNull(), 0, attachment.width, attachment.height, - attachment.caption.get(), + attachment.caption.orNull(), attachment.url, linkPreview.url, linkPreview.title)