Enable quotes in public chats

pull/489/head
Maxim Shishmarev 6 years ago
parent f8cf1cb794
commit 5cf63af3a3

@ -95,6 +95,7 @@ class LokiMessageAPI {
} }
const res = await publicSendData.sendMessage( const res = await publicSendData.sendMessage(
data.body, data.body,
data.quote,
messageTimeStamp, messageTimeStamp,
displayName, displayName,
this.ourKey this.ourKey

@ -521,6 +521,7 @@ class LokiPublicChannelAPI {
let timestamp = new Date(adnMessage.created_at).getTime(); let timestamp = new Date(adnMessage.created_at).getTime();
// pubKey lives in the username field // pubKey lives in the username field
let from = adnMessage.user.name; let from = adnMessage.user.name;
let quote = null;
if (adnMessage.is_deleted) { if (adnMessage.is_deleted) {
return; return;
} }
@ -529,7 +530,11 @@ class LokiPublicChannelAPI {
adnMessage.annotations.length !== 0 adnMessage.annotations.length !== 0
) { ) {
const noteValue = adnMessage.annotations[0].value; 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 // if user doesn't have a name set, fallback to annotation
// pubkeys are already there in v1 (first release) // pubkeys are already there in v1 (first release)
@ -571,7 +576,7 @@ class LokiPublicChannelAPI {
timestamp, timestamp,
received_at: receivedAt, received_at: receivedAt,
sent_at: timestamp, sent_at: timestamp,
quote: null, quote,
contact: [], contact: [],
preview: [], preview: [],
profile: { profile: {
@ -597,7 +602,7 @@ class LokiPublicChannelAPI {
} }
// create a message in the channel // create a message in the channel
async sendMessage(text, messageTimeStamp, displayName, pubKey) { async sendMessage(text, quote, messageTimeStamp, displayName, pubKey) {
const payload = { const payload = {
text, text,
annotations: [ annotations: [
@ -609,6 +614,7 @@ class LokiPublicChannelAPI {
from: displayName, from: displayName,
// will deprecated // will deprecated
source: pubKey, source: pubKey,
quote,
}, },
}, },
], ],

Loading…
Cancel
Save