]> git.cworth.org Git - turbot/commitdiff
Add a handler for multi_static_select input
authorCarl Worth <cworth@cworth.org>
Fri, 1 Jan 2021 01:53:29 +0000 (17:53 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 1 Jan 2021 05:46:27 +0000 (21:46 -0800)
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
turbot_lambda/turbot_lambda.py

index df2f96f634da97af16b79973fad1ae207aa6aa5b..0c1d8d92de33ded79f33e58914e580b1f430ec69 100644 (file)
@@ -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"""
 
index aa88339244872125a92e48a530c1e5cd8fb4bbc2..7622d82e46168cde94a539d42850d220d3866616 100644 (file)
@@ -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