Browse Source

fix keysend action test

push-params
Evan Feenstra 4 years ago
parent
commit
d5c7224498
  1. 17
      api/controllers/actions.ts
  2. 17
      dist/api/controllers/actions.js
  3. 2
      dist/api/controllers/actions.js.map

17
api/controllers/actions.ts

@ -48,9 +48,13 @@ export async function processAction(req, res) {
}
const a:Action = {
action, pubkey, content, amount,
bot_name:bot.name, chat_uuid,
bot_id
bot_id,
action,
pubkey: pubkey||'',
content: content||'',
amount: amount||0,
bot_name: bot.name,
chat_uuid: chat_uuid||'',
}
try {
@ -63,12 +67,13 @@ export async function processAction(req, res) {
export async function finalAction(a:Action, bot_id:string){
const {action,pubkey,amount,content,bot_name,chat_uuid} = a
if (!chat_uuid) throw 'no chat_uuid'
const owner = await models.Contact.findOne({ where: { isOwner: true } })
let theChat = await models.Chat.findOne({ where: { uuid: chat_uuid } })
let theChat
if(chat_uuid){
theChat = await models.Chat.findOne({ where: { uuid: chat_uuid } })
}
const iAmTribeAdmin = owner.publicKey === (theChat && theChat.ownerPubkey)
console.log("=> ACTION HIT", a.action, a.bot_name)
if(!iAmTribeAdmin) { // IM NOT ADMIN - its my bot and i need to forward to admin

17
dist/api/controllers/actions.js

@ -49,9 +49,13 @@ function processAction(req, res) {
return res_1.failure(res, 'no action');
}
const a = {
action, pubkey, content, amount,
bot_name: bot.name, chat_uuid,
bot_id
bot_id,
action,
pubkey: pubkey || '',
content: content || '',
amount: amount || 0,
bot_name: bot.name,
chat_uuid: chat_uuid || '',
};
try {
const r = yield finalAction(a, bot_id);
@ -66,10 +70,11 @@ exports.processAction = processAction;
function finalAction(a, bot_id) {
return __awaiter(this, void 0, void 0, function* () {
const { action, pubkey, amount, content, bot_name, chat_uuid } = a;
if (!chat_uuid)
throw 'no chat_uuid';
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
let theChat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
let theChat;
if (chat_uuid) {
theChat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
}
const iAmTribeAdmin = owner.publicKey === (theChat && theChat.ownerPubkey);
console.log("=> ACTION HIT", a.action, a.bot_name);
if (!iAmTribeAdmin) { // IM NOT ADMIN - its my bot and i need to forward to admin

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

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