]> git.cworth.org Git - turbot/commitdiff
Drop the hunt_channel_id from the metadata passed in the puzzle modal
authorCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2020 10:36:51 +0000 (03:36 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2020 10:59:39 +0000 (03:59 -0700)
We've now got another handoff, from the puzzle modal's submission
handler to a separate channel_created event before the hunt's
channel_id is needed. And by then we've lost the context of this
private_metadata, (so the current code scans through the database
'hunts' table to find the ID). Given all that, we can drop this unused
field from the metadata.

turbot/interaction.py

index 3bdd794b8b457e5a8190928cc669a47ac43042ee..b106196d28cd0fc1106905278af40ea01aea102a 100644 (file)
@@ -228,7 +228,6 @@ def puzzle(turb, body, args):
         "type": "modal",
         "private_metadata": json.dumps({
             "hunt_id": hunt_id,
-            "hunt_channel_id": channel_id
         }),
         "title": {"type": "plain_text", "text": "New Puzzle"},
         "submit": { "type": "plain_text", "text": "Create" },
@@ -263,7 +262,6 @@ def puzzle_submission(turb, payload, metadata):
 
     meta = json.loads(metadata)
     hunt_id = meta['hunt_id']
-    hunt_channel_id = meta['hunt_channel_id']
 
     state = payload['view']['state']['values']
     name = state['name']['name']['value']