Browse Source

try

bugfix/timeout-logging
Evan Feenstra 5 years ago
parent
commit
281198c406
  1. 4
      api/controllers/chatTribes.ts
  2. 3
      api/controllers/chats.ts
  3. 1
      api/controllers/confirmations.ts
  4. 2
      api/network/send.ts
  5. 4
      dist/api/controllers/chatTribes.js
  6. 2
      dist/api/controllers/chatTribes.js.map
  7. 3
      dist/api/controllers/chats.js
  8. 2
      dist/api/controllers/chats.js.map
  9. 2
      dist/api/controllers/confirmations.js
  10. 2
      dist/api/controllers/confirmations.js.map
  11. 2
      dist/api/network/send.js
  12. 2
      dist/api/network/send.js.map

4
api/controllers/chatTribes.ts

@ -153,18 +153,15 @@ async function editTribe(req, res) {
}
async function replayChatHistory(chat, contact) {
console.log('replayChatHistory')
if(!(chat&&chat.id&&contact&&contact.id)){
return console.log('[tribes] cant replay history')
}
console.log('network.typesToReplay',network.typesToReplay)
const msgs = await models.Message.findAll({
where:{chatId:chat.id, type:{[Op.in]:network.typesToReplay}},
order: [['id', 'desc']],
limit: 40
})
msgs.reverse()
console.log('msgs.length',msgs.length)
const owner = await models.Contact.findOne({ where: { isOwner: true } })
asyncForEach(msgs, async m=>{
if(!network.typesToReplay.includes(m.type)) return // only for message for now
@ -181,7 +178,6 @@ async function replayChatHistory(chat, contact) {
if(m.type===constants.message_types.attachment) {
if(m.mediaKey&&m.mediaToken) {
const muid = m.mediaToken.split('.').length && m.mediaToken.split('.')[1]
console.log('muid',muid)
if(muid) {
const mediaKey = await models.MediaKey.findOne({where:{
muid, chatId: chat.id,

3
api/controllers/chats.ts

@ -235,12 +235,11 @@ const deleteChat = async (req, res) => {
}
async function receiveGroupJoin(payload) {
console.log('=> receiveGroupJoin',payload)
console.log('=> receiveGroupJoin')
const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, date_string } = await helpers.parseReceiveParams(payload)
const chat = await models.Chat.findOne({ where: { uuid: chat_uuid } })
if (!chat) return
console.log('got chat')
const isTribe = chat_type===constants.chat_types.tribe

1
api/controllers/confirmations.ts

@ -79,6 +79,7 @@ export async function receiveConfirmation(payload) {
}
export async function tribeOwnerAutoConfirmation(msg_id,chat_uuid){
if(!msg_id || !chat_uuid) return
const message = await models.Message.findOne({ where:{id:msg_id} })
const chat = await models.Chat.findOne({where:{uuid:chat_uuid}})
if(message){

2
api/network/send.ts

@ -91,7 +91,7 @@ export async function sendMessage(params) {
}
export function signAndSend(opts, mqttTopic?:string){
console.log('sign and send!')
// console.log('sign and send!',opts)
return new Promise(async function(resolve, reject) {
if(!opts || typeof opts!=='object') {
return reject('object plz')

4
dist/api/controllers/chatTribes.js

@ -149,18 +149,15 @@ function editTribe(req, res) {
exports.editTribe = editTribe;
function replayChatHistory(chat, contact) {
return __awaiter(this, void 0, void 0, function* () {
console.log('replayChatHistory');
if (!(chat && chat.id && contact && contact.id)) {
return console.log('[tribes] cant replay history');
}
console.log('network.typesToReplay', network.typesToReplay);
const msgs = yield models_1.models.Message.findAll({
where: { chatId: chat.id, type: { [sequelize_1.Op.in]: network.typesToReplay } },
order: [['id', 'desc']],
limit: 40
});
msgs.reverse();
console.log('msgs.length', msgs.length);
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
asyncForEach(msgs, (m) => __awaiter(this, void 0, void 0, function* () {
if (!network.typesToReplay.includes(m.type))
@ -177,7 +174,6 @@ function replayChatHistory(chat, contact) {
if (m.type === constants.message_types.attachment) {
if (m.mediaKey && m.mediaToken) {
const muid = m.mediaToken.split('.').length && m.mediaToken.split('.')[1];
console.log('muid', muid);
if (muid) {
const mediaKey = yield models_1.models.MediaKey.findOne({ where: {
muid, chatId: chat.id,

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

File diff suppressed because one or more lines are too long

3
dist/api/controllers/chats.js

@ -226,12 +226,11 @@ const deleteChat = (req, res) => __awaiter(void 0, void 0, void 0, function* ()
exports.deleteChat = deleteChat;
function receiveGroupJoin(payload) {
return __awaiter(this, void 0, void 0, function* () {
console.log('=> receiveGroupJoin', payload);
console.log('=> receiveGroupJoin');
const { sender_pub_key, sender_alias, chat_uuid, chat_members, chat_type, isTribeOwner, date_string } = yield helpers.parseReceiveParams(payload);
const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
if (!chat)
return;
console.log('got chat');
const isTribe = chat_type === constants.chat_types.tribe;
var date = new Date();
date.setMilliseconds(0);

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

File diff suppressed because one or more lines are too long

2
dist/api/controllers/confirmations.js

@ -90,6 +90,8 @@ function receiveConfirmation(payload) {
exports.receiveConfirmation = receiveConfirmation;
function tribeOwnerAutoConfirmation(msg_id, chat_uuid) {
return __awaiter(this, void 0, void 0, function* () {
if (!msg_id || !chat_uuid)
return;
const message = yield models_1.models.Message.findOne({ where: { id: msg_id } });
const chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
if (message) {

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

@ -1 +1 @@
{"version":3,"file":"confirmations.js","sourceRoot":"","sources":["../../../api/controllers/confirmations.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,wCAAgC;AAChC,sCAAgC;AAChC,0CAAyC;AACzC,2CAA0C;AAC1C,sCAAqC;AACrC,6BAA4B;AAE5B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAE7E,SAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE;IACxD,IAAG,CAAC,MAAM;QAAE,OAAM;IAClB,OAAO,CAAC,WAAW,CAAC;QACnB,IAAI;QACJ,MAAM;QACN,OAAO,EAAE,EAAC,EAAE,EAAC,MAAM,EAAC;QACpB,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,YAAY;KAC1C,CAAC,CAAA;AACH,CAAC;AARD,4CAQC;AAED,SAAsB,mBAAmB,CAAC,OAAO;;QAChD,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,OAAO,CAAC,OAAO,IAAE,OAAO,CAAC,O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EAAE,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;aACtD,CAAC,CAAA;SACF;IACF,CAAC;CAAA;AApBD,gEAoBC"}

2
dist/api/network/send.js

@ -100,7 +100,7 @@ function sendMessage(params) {
}
exports.sendMessage = sendMessage;
function signAndSend(opts, mqttTopic) {
console.log('sign and send!');
// console.log('sign and send!',opts)
return new Promise(function (resolve, reject) {
return __awaiter(this, void 0, void 0, function* () {
if (!opts || typeof opts !== 'object') {

2
dist/api/network/send.js.map

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