diff --git a/js/modules/loki_message_api.js b/js/modules/loki_message_api.js index 227541929..f9c3610d6 100644 --- a/js/modules/loki_message_api.js +++ b/js/modules/loki_message_api.js @@ -95,6 +95,7 @@ class LokiMessageAPI { } const res = await publicSendData.sendMessage( data.body, + data.quote, messageTimeStamp, displayName, this.ourKey diff --git a/js/modules/loki_public_chat_api.js b/js/modules/loki_public_chat_api.js index 51ac48520..03285f32b 100644 --- a/js/modules/loki_public_chat_api.js +++ b/js/modules/loki_public_chat_api.js @@ -523,6 +523,7 @@ class LokiPublicChannelAPI { let timestamp = new Date(adnMessage.created_at).getTime(); // pubKey lives in the username field let from = adnMessage.user.name; + let quote = null; if (adnMessage.is_deleted) { return; } @@ -531,7 +532,11 @@ class LokiPublicChannelAPI { adnMessage.annotations.length !== 0 ) { const noteValue = adnMessage.annotations[0].value; - ({ timestamp } = noteValue); + ({ timestamp, quote } = noteValue); + + if (quote) { + quote.attachments = []; + } // if user doesn't have a name set, fallback to annotation // pubkeys are already there in v1 (first release) @@ -573,7 +578,7 @@ class LokiPublicChannelAPI { timestamp, received_at: receivedAt, sent_at: timestamp, - quote: null, + quote, contact: [], preview: [], profile: { @@ -599,7 +604,7 @@ class LokiPublicChannelAPI { } // create a message in the channel - async sendMessage(text, messageTimeStamp, displayName, pubKey) { + async sendMessage(text, quote, messageTimeStamp, displayName, pubKey) { const payload = { text, annotations: [ @@ -611,6 +616,7 @@ class LokiPublicChannelAPI { from: displayName, // will deprecated source: pubKey, + quote, }, }, ],