From a97788c7d99b9c3b8fd723d8bca21e97ce1a9ef1 Mon Sep 17 00:00:00 2001 From: Ryan Tharp <neuro@interx.net> Date: Wed, 18 Sep 2019 21:52:12 -0700 Subject: [PATCH] modernize annotations since we're making a backward-incomp change --- js/modules/loki_public_chat_api.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/js/modules/loki_public_chat_api.js b/js/modules/loki_public_chat_api.js index f81df9731..955d1a0b0 100644 --- a/js/modules/loki_public_chat_api.js +++ b/js/modules/loki_public_chat_api.js @@ -577,16 +577,13 @@ class LokiPublicChannelAPI { adnMessage.annotations.length !== 0 ) { const noteValue = adnMessage.annotations[0].value; - ({ timestamp, quote } = noteValue); + ({ timestamp } = noteValue); - if (quote) { - quote.attachments = []; - } - - // if user doesn't have a name set, fallback to annotation - // pubkeys are already there in v1 (first release) - if (!from) { - ({ from } = noteValue); + if (noteValue.quote) { + ({ quote } = noteValue); + if (quote) { + quote.attachments = []; + } } if (noteValue.sig) { @@ -723,16 +720,13 @@ class LokiPublicChannelAPI { type: 'network.loki.messenger.publicChat', value: { timestamp: messageTimeStamp, - // will deprecated - from: displayName, - // will deprecated - source: pubKey, - quote, }, }, ], }; if (quote && quote.id) { + payload.annoations[0].value.quote = quote; + // copied from model/message.js copyFromQuotedMessage const collection = await Signal.Data.getMessagesBySentAt(quote.id, { MessageCollection: Whisper.MessageCollection,