]> git.cworth.org Git - turbot/blobdiff - turbot/interaction.py
Add a state field to the "edit hunt" form
[turbot] / turbot / interaction.py
index 21e741e8c19ac84776e8c36330c295876315d553..25307c22a26aec26084da1b623ebaee2acec069f 100644 (file)
@@ -5,7 +5,8 @@ from turbot.blocks import (
 from turbot.hunt import (
     find_hunt_for_hunt_id,
     hunt_blocks,
-    hunt_puzzles_for_hunt_id
+    hunt_puzzles_for_hunt_id,
+    hunt_update_topic
 )
 from turbot.puzzle import (
     find_puzzle_for_url,
@@ -459,6 +460,10 @@ def edit_hunt(turb, hunt, trigger_id):
             input_block("Hunt URL", "url", "External URL of hunt",
                         initial_value=hunt.get("url", None),
                         optional=True),
+            input_block("State", "state",
+                        "State of the hunt (goals, upcoming meetings, etc.)",
+                        initial_value=hunt.get("state", None),
+                        optional=True),
             checkbox_block("Is this hunt active?", "Active", "active",
                            checked=(hunt.get('active', False)))
         ]
@@ -497,6 +502,9 @@ def edit_hunt_submission(turb, payload, metadata):
     if url:
         hunt['url'] = url
 
+    hunt_state = state['state']['state']['value']
+    if hunt_state:
+        hunt['state'] = hunt_state
     if state['active']['active']['selected_options']:
         hunt['active'] = True
     else:
@@ -522,6 +530,9 @@ def edit_hunt_submission(turb, payload, metadata):
         turb.slack_client, hunt['channel_id'],
         edit_message, blocks=blocks)
 
+    # Update channel topic and description
+    hunt_update_topic(turb, hunt)
+
     return lambda_ok
 
 def new_hunt_command(turb, body):