Skip to content

Commit

Permalink
Merge pull request howdyai#1979 from ashitikov/channelData-replace-fix
Browse files Browse the repository at this point in the history
Fix channelData replace in conversations
  • Loading branch information
benbrown authored Aug 21, 2020
2 parents 85e052f + e436cbe commit 74da283
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/botkit/src/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,13 @@ export class BotkitConversation<O extends object = {}> extends Dialog<O> {
}

// copy all the values in channelData fields
for (const key in line.channelData) {
outgoing.channelData = this.parseTemplatesRecursive(JSON.parse(JSON.stringify(line.channelData)), vars)
if (line.channelData && Object.keys(line.channelData).length > 0) {
const channelDataParsed = this.parseTemplatesRecursive(JSON.parse(JSON.stringify(line.channelData)), vars);

outgoing.channelData = {
...outgoing.channelData,
...channelDataParsed
};
}

/*******************************************************************************************************************/
Expand Down

0 comments on commit 74da283

Please sign in to comment.