From b8af6fd184d500940043fa8ca164de0bfb1a0ac9 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 31 Dec 2020 09:41:45 -0700 Subject: [PATCH] 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. --- turbot/events.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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")) ] -- 2.43.0