diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e195992..d735a7c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow mobile app to access escalation options endpoints @imtoori ([#3847](https://github.com/grafana/oncall/pull/3847))
- Enable templating for alert escalation mobile app push notifications by @joeyorlando ([#3845](https://github.com/grafana/oncall/pull/3845))
+- Change email notification template to not wrap user template @mderynck ([#3862](https://github.com/grafana/oncall/pull/3862))
## v1.3.102 (2024-02-06)
diff --git a/engine/apps/email/alert_rendering.py b/engine/apps/email/alert_rendering.py
index c2897a88..4ac0eac0 100644
--- a/engine/apps/email/alert_rendering.py
+++ b/engine/apps/email/alert_rendering.py
@@ -39,17 +39,17 @@ def build_subject_and_message(alert_group, emails_left):
content = render_to_string(
"email_notification.html",
{
- "url": alert_group.slack_permalink or alert_group.web_link,
- "title": str_or_backup(templated_alert.title, title_fallback),
- "message": str_or_backup(message, ""), # not render message at all if smth goes wrong
- "organization": alert_group.channel.organization.org_title,
- "integration": emojize(alert_group.channel.short_name, language="alias"),
+ "message": str_or_backup(message, title_fallback),
"limit_notification": emails_left <= 20,
"emails_left": emails_left,
+ "url": alert_group.slack_permalink or alert_group.web_link,
+ "alert_group_number": str(alert_group.inside_organization_number),
+ "integration": emojize(alert_group.channel.short_name, language="alias"),
+ "instance_url": alert_group.channel.organization.grafana_url,
},
)
title = str_or_backup(templated_alert.title, title_fallback)
- subject = f"[{title}] You are invited to check an alert group".replace("\n", "")
+ subject = f"{title}".replace("\n", "")
return subject, content
diff --git a/engine/apps/email/templates/email_notification.html b/engine/apps/email/templates/email_notification.html
index 86ade2bb..6418d6ab 100644
--- a/engine/apps/email/templates/email_notification.html
+++ b/engine/apps/email/templates/email_notification.html
@@ -1,28 +1,23 @@
-You are invited to check an alert group in Grafana OnCall!
-
-Organization: {{ organization }}
-
-Integration: {{ integration }}
-
-Title: {{ title }}
-{% if message %}
-
-Message:
-
{% autoescape off %}
- {{ message }}
+{{ message }}
{% endautoescape %}
-{% endif %}
-
-Go to the alert group
-
-Your Grafana OnCall
+
{% if limit_notification %}
{{ emails_left }} emails left for the organization today. Contact your admin.
{% endif %}
+
+ - Your Grafana OnCall +
+ \ No newline at end of file diff --git a/engine/apps/email/tests/test_notify_user.py b/engine/apps/email/tests/test_notify_user.py index fd892e10..f33cdaaf 100644 --- a/engine/apps/email/tests/test_notify_user.py +++ b/engine/apps/email/tests/test_notify_user.py @@ -211,4 +211,4 @@ def test_subject_newlines_removed( make_alert(alert_group, raw_request_data={}) subject, _ = build_subject_and_message(alert_group, 1) - assert subject == "[testnewlines] You are invited to check an alert group" + assert subject == "testnewlines"