mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
fix sending link preview to open group
This commit is contained in:
parent
70a7182320
commit
d85ad12352
1 changed files with 3 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue