Browse Source

include date in payload

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
7398acc82b
  1. 7
      api/controllers/chatTribes.ts
  2. 7
      dist/api/controllers/chatTribes.js
  3. 2
      dist/api/controllers/chatTribes.js.map

7
api/controllers/chatTribes.ts

@ -166,8 +166,8 @@ async function replayChatHistory(chat, contact) {
let content = ''
try {content = JSON.parse(m.remoteMessageContent)} catch(e) {}
console.log(m.date, typeof m.date)
console.log(m.date, typeof m.date, m.data.toISOString())
const dateString = m.date&&m.date.toISOString()
let mediaKeyMap
let newMediaTerms
if(m.type===constants.message_types.attachment) {
@ -176,7 +176,7 @@ async function replayChatHistory(chat, contact) {
const mediaKey = await models.MediaKey.findOne({where:{
muid, chatId: chat.id,
}})
console.log("FOUND MEDIA KEY!!",mediaKey.dataValues)
// console.log("FOUND MEDIA KEY!!",mediaKey.dataValues)
mediaKeyMap = {chat: mediaKey.key}
newMediaTerms = {muid: mediaKey.muid}
}
@ -186,6 +186,7 @@ async function replayChatHistory(chat, contact) {
...mediaKeyMap && {mediaKey: mediaKeyMap},
...newMediaTerms && {mediaToken: newMediaTerms},
...m.mediaType && {mediaType: m.mediaType},
...dateString && {date: dateString}
})
msg = await decryptMessage(msg, chat)
const data = await personalizeMessage(msg, contact, true)

7
dist/api/controllers/chatTribes.js

@ -164,7 +164,8 @@ function replayChatHistory(chat, contact) {
content = JSON.parse(m.remoteMessageContent);
}
catch (e) { }
console.log(m.date, typeof m.date);
console.log(m.date, typeof m.date, m.data.toISOString());
const dateString = m.date && m.date.toISOString();
let mediaKeyMap;
let newMediaTerms;
if (m.type === constants.message_types.attachment) {
@ -173,12 +174,12 @@ function replayChatHistory(chat, contact) {
const mediaKey = yield models_1.models.MediaKey.findOne({ where: {
muid, chatId: chat.id,
} });
console.log("FOUND MEDIA KEY!!", mediaKey.dataValues);
// console.log("FOUND MEDIA KEY!!",mediaKey.dataValues)
mediaKeyMap = { chat: mediaKey.key };
newMediaTerms = { muid: mediaKey.muid };
}
}
let msg = network.newmsg(m.type, chat, sender, Object.assign(Object.assign(Object.assign({ content }, mediaKeyMap && { mediaKey: mediaKeyMap }), newMediaTerms && { mediaToken: newMediaTerms }), m.mediaType && { mediaType: m.mediaType }));
let msg = network.newmsg(m.type, chat, sender, Object.assign(Object.assign(Object.assign(Object.assign({ content }, mediaKeyMap && { mediaKey: mediaKeyMap }), newMediaTerms && { mediaToken: newMediaTerms }), m.mediaType && { mediaType: m.mediaType }), dateString && { date: dateString }));
msg = yield msg_1.decryptMessage(msg, chat);
const data = yield msg_1.personalizeMessage(msg, contact, true);
const mqttTopic = `${contact.publicKey}/${chat.uuid}`;

2
dist/api/controllers/chatTribes.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save