Browse Source

fix og sender media key save

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

7
api/controllers/media.ts

@ -213,7 +213,7 @@ const receivePurchase = async (payload) => {
var date = new Date();
date.setMilliseconds(0)
const {owner, sender, chat, amount, mediaToken, msg_uuid} = await helpers.parseReceiveParams(payload)
const {owner, sender, chat, amount, mediaToken, msg_uuid, chat_type} = await helpers.parseReceiveParams(payload)
if(!owner || !sender || !chat) {
return console.log('=> group chat not found!')
}
@ -244,9 +244,12 @@ const receivePurchase = async (payload) => {
if (!ogMessage){
return console.log('no original message')
}
const isTribe = chat_type===constants.chat_types.tribe
// find mediaKey for who sent
const mediaKey = await models.MediaKey.findOne({where:{
muid, receiver: sender.id,
muid, receiver: isTribe?0:sender.id,
}})
console.log('mediaKey found!',mediaKey)
if(!mediaKey) return // this is from another person (admin is forwarding)

5
dist/api/controllers/media.js

@ -189,7 +189,7 @@ const receivePurchase = (payload) => __awaiter(void 0, void 0, void 0, function*
console.log('=> received purchase', { payload });
var date = new Date();
date.setMilliseconds(0);
const { owner, sender, chat, amount, mediaToken, msg_uuid } = yield helpers.parseReceiveParams(payload);
const { owner, sender, chat, amount, mediaToken, msg_uuid, chat_type } = yield helpers.parseReceiveParams(payload);
if (!owner || !sender || !chat) {
return console.log('=> group chat not found!');
}
@ -217,9 +217,10 @@ const receivePurchase = (payload) => __awaiter(void 0, void 0, void 0, function*
if (!ogMessage) {
return console.log('no original message');
}
const isTribe = chat_type === constants.chat_types.tribe;
// find mediaKey for who sent
const mediaKey = yield models_1.models.MediaKey.findOne({ where: {
muid, receiver: sender.id,
muid, receiver: isTribe ? 0 : sender.id,
} });
console.log('mediaKey found!', mediaKey);
if (!mediaKey)

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

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