From 48b4faf7c1e15cf1db658dcf906bd9b8e7a0949d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Oct 2020 11:59:27 -0700 Subject: [PATCH] Allow input blocks to be optional And use this to make the "Hunt URL" field optional (since some hunts might not have any URL). --- turbot/actions.py | 3 ++- turbot/blocks.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/turbot/actions.py b/turbot/actions.py index 4b24f85..5bc815e 100644 --- a/turbot/actions.py +++ b/turbot/actions.py @@ -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) ], } diff --git a/turbot/blocks.py b/turbot/blocks.py index 5222e87..a18c055 100644 --- a/turbot/blocks.py +++ b/turbot/blocks.py @@ -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, -- 2.45.2