From 7a68a1c7360a30d046d9e415dd3ab6294db97173 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 31 Dec 2020 17:53:29 -0800 Subject: [PATCH] Add a handler for multi_static_select input The documentation of the multi_static_select input block wasn't clear that it would trigger a call to an event handler, but apparently it does. We don't currently impose any restrictions on what a user selects, (any combination of rounds is valid), so we simply return a lamba_ok value for any selection. This prevents the user from seeing a warning sign in the dialog (where hovering over it would say that the callback returned 502). --- turbot/interaction.py | 7 +++++++ turbot_lambda/turbot_lambda.py | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/turbot/interaction.py b/turbot/interaction.py index df2f96f..0c1d8d9 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -52,6 +52,13 @@ def submission_error(field, error): }) } +def multi_static_select(turb, payload): + """Handler for the action of user entering a multi-select value""" + + return lambda_ok + +actions['multi_static_select'] = {"*": multi_static_select} + def new_hunt(turb, payload): """Handler for the action of user pressing the new_hunt button""" diff --git a/turbot_lambda/turbot_lambda.py b/turbot_lambda/turbot_lambda.py index aa88339..7622d82 100644 --- a/turbot_lambda/turbot_lambda.py +++ b/turbot_lambda/turbot_lambda.py @@ -199,7 +199,10 @@ def turbot_block_action(turb, payload): action = actions[0] atype = action['type'] - avalue = action['value'] + if 'value' in action: + avalue = action['value'] + else: + avalue = '*' if ( atype in turbot.interaction.actions -- 2.43.0