From: Carl Worth Date: Wed, 14 Oct 2020 01:19:56 +0000 (-0700) Subject: Add a link each hunt's channel in the Home view X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=7ee3eb858037ec49d021235b8f1b94479fbb954a;p=turbot Add a link each hunt's channel in the Home view Making it much easier to get to the hunt, of course. --- diff --git a/turbot/views.py b/turbot/views.py index aa0f010..2acc474 100644 --- a/turbot/views.py +++ b/turbot/views.py @@ -1,4 +1,4 @@ -def text(body): +def text_block(body): return { "text": { "type": "mrkdwn", @@ -29,6 +29,10 @@ def button(label, name): "value": name } +def hunt_block(hunt): + text = "{}: <#{}>".format(hunt['name'], hunt['channel']) + return section(text_block(text)) + def home(turb, user_id, body): """Returns a view to be published as the turbot home tab for user_id @@ -42,8 +46,8 @@ def home(turb, user_id, body): return { "type": "home", "blocks": [ - section(text("*Active hunts*")), - *[section(text(hunt['name'])) for hunt in hunts if hunt['active']], + section(text_block("*Active hunts*")), + *[hunt_block(hunt) for hunt in hunts if hunt['active']], actions(button("New hunt", "new_hunt")) ] }