Browse Source

test history

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
379a3a9830
  1. 9
      api/controllers/chatTribes.ts
  2. 4
      api/controllers/index.ts
  3. 10
      dist/api/controllers/chatTribes.js
  4. 2
      dist/api/controllers/chatTribes.js.map
  5. 3
      dist/api/controllers/index.js
  6. 2
      dist/api/controllers/index.js.map

9
api/controllers/chatTribes.ts

@ -156,15 +156,16 @@ async function replayChatHistory(chat, contact) {
}
let msg = network.newmsg(m.type, chat, sender, {
content: m.remoteContent, // replace with the received content (u are owner)
mediaKey: m.mediaKey,
mediaType: m.mediaType,
mediaToken: m.mediaToken
...m.mediaKey && {mediaKey: m.mediaKey},
...m.mediaType && {mediaType: m.mediaType},
...m.mediaToken && {mediaToken: m.mediaToken}
})
msg = await decryptMessage(msg, chat)
const data = await personalizeMessage(msg, contact, true)
const mqttTopic = `${contact.publicKey}/${chat.uuid}`
await network.signAndSend({data}, owner.publicKey, mqttTopic)
console.log('replay ======>',mqttTopic,{data})
//await network.signAndSend({data}, owner.publicKey, mqttTopic)
})
}

4
api/controllers/index.ts

@ -20,6 +20,10 @@ const constants = require(path.join(__dirname,'../../config/constants.json'))
async function set(app) {
const chat = await models.Chat.findOne({where:{id:31}})
const contact = await models.Chat.findOne({where:{id:21}})
chatTribes.replayChatHistory(chat,contact)
if(models && models.Subscription){
subcriptions.initializeCronJobs()
}

10
dist/api/controllers/chatTribes.js

@ -148,16 +148,12 @@ function replayChatHistory(chat, contact) {
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
asyncForEach(msgs, (m) => __awaiter(this, void 0, void 0, function* () {
const sender = Object.assign(Object.assign({}, owner.dataValues), m.senderAlias && { alias: m.senderAlias });
let msg = network.newmsg(m.type, chat, sender, {
content: m.remoteContent,
mediaKey: m.mediaKey,
mediaType: m.mediaType,
mediaToken: m.mediaToken
});
let msg = network.newmsg(m.type, chat, sender, Object.assign(Object.assign(Object.assign({ content: m.remoteContent }, m.mediaKey && { mediaKey: m.mediaKey }), m.mediaType && { mediaType: m.mediaType }), m.mediaToken && { mediaToken: m.mediaToken }));
msg = yield msg_1.decryptMessage(msg, chat);
const data = yield msg_1.personalizeMessage(msg, contact, true);
const mqttTopic = `${contact.publicKey}/${chat.uuid}`;
yield network.signAndSend({ data }, owner.publicKey, mqttTopic);
console.log('replay ======>', mqttTopic, { data });
//await network.signAndSend({data}, owner.publicKey, mqttTopic)
}));
});
}

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

File diff suppressed because one or more lines are too long

3
dist/api/controllers/index.js

@ -29,6 +29,9 @@ console.log("=> env:", env);
const constants = require(path.join(__dirname, '../../config/constants.json'));
function set(app) {
return __awaiter(this, void 0, void 0, function* () {
const chat = yield models_1.models.Chat.findOne({ where: { id: 31 } });
const contact = yield models_1.models.Chat.findOne({ where: { id: 21 } });
chatTribes.replayChatHistory(chat, contact);
if (models_1.models && models_1.models.Subscription) {
subcriptions.initializeCronJobs();
}

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

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