From ca406288d9ef3635a5d7342d88a6be9fa19de1d4 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 3 Sep 2024 12:31:36 -0700 Subject: [PATCH] webhooks: Fix strange joining code in greenhous webhook. --- zerver/webhooks/greenhouse/view.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zerver/webhooks/greenhouse/view.py b/zerver/webhooks/greenhouse/view.py index 5759bc0cb6..36c2f40ec3 100644 --- a/zerver/webhooks/greenhouse/view.py +++ b/zerver/webhooks/greenhouse/view.py @@ -16,18 +16,17 @@ MESSAGE_TEMPLATE = """ def dict_list_to_string(some_list: WildValue) -> str: - internal_template = "" + response_chunks = [] for item in some_list: item_type = item.get("type", "").tame(check_string).title() item_value = item.get("value").tame(check_none_or(check_string)) item_url = item.get("url").tame(check_none_or(check_url)) if item_type and item_value: - internal_template += f"{item_value} ({item_type}), " + response_chunks.append(f"{item_value} ({item_type})") elif item_type and item_url: - internal_template += f"[{item_type}]({item_url}), " + response_chunks.append(f"[{item_type}]({item_url})") - internal_template = internal_template.removesuffix(", ") - return internal_template + return ", ".join(response_chunks) @webhook_view("Greenhouse")