]> git.cworth.org Git - turbot/commitdiff
Allow input blocks to be optional
authorCarl Worth <cworth@cworth.org>
Tue, 20 Oct 2020 18:59:27 +0000 (11:59 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 20 Oct 2020 18:59:27 +0000 (11:59 -0700)
And use this to make the "Hunt URL" field optional (since some hunts
might not have any URL).

turbot/actions.py
turbot/blocks.py

index 4b24f85d8f5da260995b3bc7b6ee4f00c251fd60..5bc815e34ac07a3f92b9f75824598d4be9ec8d82 100644 (file)
@@ -12,7 +12,8 @@ def new_hunt(turb, payload):
         "blocks": [
             input_block("Hunt name", "name", "Name of the hunt"),
             input_block("Hunt ID", "slug", "Short hunt prefix (no spaces)"),
-            input_block("Hunt URL", "url", "External URL of hunt")
+            input_block("Hunt URL", "url", "External URL of hunt",
+                        optional=True)
         ],
     }
 
index 5222e87e0433d248c2805ca0973396c411165dd2..a18c0558a072cb18e7284123b4311d55a2537916 100644 (file)
@@ -29,10 +29,11 @@ def button_block(label, name):
         "value": name
     }
 
-def input_block(label, name, placeholder):
+def input_block(label, name, placeholder, optional=False):
     return {
         "type": "input",
         "block_id": name,
+        "optional": optional,
         "element": {
             "type": "plain_text_input",
             "action_id": name,