From: Carl Worth Date: Thu, 31 Dec 2020 16:41:45 +0000 (-0700) Subject: Turbot home: Report "you do not belong to any hunts" if that is the case X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=b8af6fd184d500940043fa8ca164de0bfb1a0ac9;p=turbot Turbot home: Report "you do not belong to any hunts" if that is the case Instead of having the header "Hunts you belong to" followed by nothing. --- diff --git a/turbot/events.py b/turbot/events.py index 64430e5..a118835 100644 --- a/turbot/events.py +++ b/turbot/events.py @@ -91,11 +91,20 @@ def home(turb, user_id): continue hunt_blocks += hunt_block(turb, hunt) + if len(hunt_blocks): + hunt_blocks = [ + section_block(text_block("*Hunts you belong to*")), + divider_block(), + * hunt_blocks + ] + else: + hunt_blocks = [ + section_block(text_block("You do not belong to any hunts")) + ] + return { "type": "home", "blocks": [ - section_block(text_block("*Hunts you belong to*")), - divider_block(), * hunt_blocks, actions_block(button_block("New hunt", "new_hunt")) ]