Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Default unfurling of links and media to False in Slack notifications (#743)

Staci Cooper3b58e60c2b8f
diff --git a/openverse_catalog/dags/common/slack.py b/openverse_catalog/dags/common/slack.py
index 330d41991..8a3544cc8 100644
--- a/openverse_catalog/dags/common/slack.py
+++ b/openverse_catalog/dags/common/slack.py
@@ -282,8 +282,8 @@ def send_message(
username: str = "Airflow",
icon_emoji: str = ":airflow:",
markdown: bool = True,
- unfurl_links: bool = True,
- unfurl_media: bool = True,
+ unfurl_links: bool = False,
+ unfurl_media: bool = False,
http_conn_id: str = SLACK_NOTIFICATIONS_CONN_ID,
) -> None:
"""Send a simple slack message, convenience message for short/simple messages."""
@@ -309,8 +309,8 @@ def send_alert(
username: str = "Airflow Alert",
icon_emoji: str = ":airflow:",
markdown: bool = True,
- unfurl_links: bool = True,
- unfurl_media: bool = True,
+ unfurl_links: bool = False,
+ unfurl_media: bool = False,
):
"""
Wrapper for send_message that allows sending a message to the configured alerts
diff --git a/tests/dags/common/test_slack.py b/tests/dags/common/test_slack.py
index 1909780f9..8b0c91879 100644
--- a/tests/dags/common/test_slack.py
+++ b/tests/dags/common/test_slack.py
@@ -435,7 +435,7 @@ def test_send_message(environment, http_hook_mock):
send_message("Sample text", dag_id="test_workflow", username="DifferentUser")
http_hook_mock.run.assert_called_with(
endpoint=None,
- data=f'{{"username": "DifferentUser | {environment}", "unfurl_links": true, "unfurl_media": true,'
+ data=f'{{"username": "DifferentUser | {environment}", "unfurl_links": false, "unfurl_media": false,'
' "icon_emoji": ":airflow:", "blocks": [{"type": "section", "text": '
'{"type": "mrkdwn", "text": "Sample text"}}], "text": "Sample text"}',
headers={"Content-type": "application/json"},
@@ -458,8 +458,8 @@ def test_send_alert():
"DifferentUser",
":airflow:",
True,
- True,
- True,
+ False,
+ False,
http_conn_id=SLACK_ALERTS_CONN_ID,
)