modernize annotations since we're making a backward-incomp change

pull/517/head
Ryan Tharp 6 years ago
parent a0b52826e9
commit a97788c7d9

@ -577,16 +577,13 @@ class LokiPublicChannelAPI {
adnMessage.annotations.length !== 0 adnMessage.annotations.length !== 0
) { ) {
const noteValue = adnMessage.annotations[0].value; const noteValue = adnMessage.annotations[0].value;
({ timestamp, quote } = noteValue); ({ timestamp } = noteValue);
if (quote) { if (noteValue.quote) {
quote.attachments = []; ({ 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)
if (!from) {
({ from } = noteValue);
} }
if (noteValue.sig) { if (noteValue.sig) {
@ -723,16 +720,13 @@ class LokiPublicChannelAPI {
type: 'network.loki.messenger.publicChat', type: 'network.loki.messenger.publicChat',
value: { value: {
timestamp: messageTimeStamp, timestamp: messageTimeStamp,
// will deprecated
from: displayName,
// will deprecated
source: pubKey,
quote,
}, },
}, },
], ],
}; };
if (quote && quote.id) { if (quote && quote.id) {
payload.annoations[0].value.quote = quote;
// copied from model/message.js copyFromQuotedMessage // copied from model/message.js copyFromQuotedMessage
const collection = await Signal.Data.getMessagesBySentAt(quote.id, { const collection = await Signal.Data.getMessagesBySentAt(quote.id, {
MessageCollection: Whisper.MessageCollection, MessageCollection: Whisper.MessageCollection,

Loading…
Cancel
Save