From 7ee3eb858037ec49d021235b8f1b94479fbb954a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 13 Oct 2020 18:19:56 -0700 Subject: [PATCH] Add a link each hunt's channel in the Home view Making it much easier to get to the hunt, of course. --- turbot/views.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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")) ] } -- 2.45.2