Skip to content

Commit

Permalink
Merge pull request #4326 from RasaHQ/send-elements-1
Browse files Browse the repository at this point in the history
fix bug in send elements default implementation
  • Loading branch information
erohmensing committed Aug 28, 2019
2 parents 3c3b162 + 8c0a445 commit 7b9c4c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Removed

Fixed
-----
- fixed bug that occurred when sending ``elements:`` through a channel that doesn't support them


[1.2.5] - 2019-08-26
^^^^^^^^^^^^^^^^^^^^
Expand Down
5 changes: 4 additions & 1 deletion rasa/core/channels/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,15 @@ async def send_elements(
Default implementation will just post the elements as a string."""

# we can't pass the empty "buttons" key of the message through to send_text_with_buttons()
kwargs.pop("buttons", None)

for element in elements:
element_msg = "{title} : {subtitle}".format(
title=element.get("title", ""), subtitle=element.get("subtitle", "")
)
await self.send_text_with_buttons(
recipient_id, element_msg, element.get("buttons", [], **kwargs)
recipient_id, element_msg, element.get("buttons", []), **kwargs
)

async def send_custom_json(
Expand Down

0 comments on commit 7b9c4c5

Please sign in to comment.