-def text(body):
+def text_block(body):
return {
"text": {
"type": "mrkdwn",
"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
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"))
]
}