Skip to content

Commit

Permalink
fix(actions): added missing shortcuts when parsing actions
Browse files Browse the repository at this point in the history
  • Loading branch information
allardy committed Feb 12, 2019
1 parent 4bdc28c commit 3a2730d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bp/core/services/dialog/instruction/strategy.ts
Expand Up @@ -110,7 +110,14 @@ export class ActionStrategy implements InstructionStrategy {
throw new Error(`Action "${actionName}" has invalid arguments (not a valid JSON string): ${argsStr}`)
}

args = _.mapValues(args, value => renderRecursive(value, { event }))
const actionArgs = {
event,
user: _.get(event, 'state.user') || {},
session: _.get(event, 'state.session') || {},
temp: _.get(event, 'state.temp') || {}
}

args = _.mapValues(args, value => renderRecursive(value, actionArgs))

const hasAction = await this.actionService.forBot(botId).hasAction(actionName)
if (!hasAction) {
Expand Down

0 comments on commit 3a2730d

Please sign in to comment.