Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
slack_integration: Process Slack `blocks` and `attachments` syntax.
PieterCK210f35e3a9ac
diff --git a/zerver/webhooks/slack/tests.py b/zerver/webhooks/slack/tests.pyindex 80603e8b259..8738bd17db9 100644--- a/zerver/webhooks/slack/tests.py+++ b/zerver/webhooks/slack/tests.py@@ -302,7 +302,17 @@ class SlackWebhookTests(WebhookTestCase):@mock_slack_api_callsdef test_message_from_slack_integration_bot(self) -> None:- message_body = "**Task status changed** from `complete` to `to do`"+ message_body = """+**Task status changed** from `complete` to `to do`+**<https://app.clickup.com/t/25567147/86cw30wf2|asd>**++[Cookie / The Goodiest of Cstdddddsdd / dds](https://search.clickup-au.com/media/app-icons/clickup/logo_alpha.png)++in dds++[Status](https://search.clickup-au.com/media/app-icons/clickup/status.png)++To Do""".strip()# The integration message is from Slack's ClickUp webhook integration.expected_message = EXPECTED_MESSAGE.format(user="ClickUp", message=message_body)diff --git a/zerver/webhooks/slack/view.py b/zerver/webhooks/slack/view.pyindex 42296104d37..e539994c7f9 100644--- a/zerver/webhooks/slack/view.py+++ b/zerver/webhooks/slack/view.py@@ -11,6 +11,7 @@ from zerver.data_import.slack_message_conversion import (SLACK_USERMENTION_REGEX,convert_slack_formatting,convert_slack_workspace_mentions,+ process_slack_block_and_attachment,replace_links,)from zerver.decorator import webhook_view@@ -262,15 +263,12 @@ def api_slack_webhook(raw_files = event_dict.get("files")files = convert_raw_file_data(raw_files) if raw_files else []- raw_text = event_dict.get("text", "").tame(check_string)+ raw_text = process_slack_block_and_attachment(event_dict)text = convert_to_zulip_markdown(raw_text, slack_app_token)user_id = event_dict.get("user").tame(check_none_or(check_string))if user_id is None:# This is likely a Slack integration bot message. The sender of these# messages doesn't have a user profile.- # TODO: This class of message typically use more Slack blocks and- # attachments, which the Slack webhook integration currently doesn't- # support.sender = event_dict["username"].tame(check_string)else:sender = get_slack_sender_name(user_id, slack_app_token)