Skip to content

Commit f2bf4a4

Browse files
committed
fix: Fix email template inconsistency. Realtime emails now fallback to message.html and message.txt, just like digest emails
1 parent 7bf5f07 commit f2bf4a4

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

docs/customizing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ Customize email templates by creating these files in your templates directory:
134134
If notification-type specific templates are not found, the system will fall back to:
135135

136136
- `notifications/email/realtime/subject.txt`
137-
- `notifications/email/realtime/body.html`
138-
- `notifications/email/realtime/body.txt`
137+
- `notifications/email/realtime/message.html`
138+
- `notifications/email/realtime/message.txt`
139139

140140
This allows you to create generic templates that work for all notification types while still having the flexibility to create specific templates for certain types.
141141

generic_notifications/channels.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ def send_now(self, notification: "Notification") -> None:
176176
]
177177
html_templates = [
178178
f"notifications/email/realtime/{notification.notification_type}.html",
179-
"notifications/email/realtime/body.html",
179+
"notifications/email/realtime/message.html",
180180
]
181181
text_templates = [
182182
f"notifications/email/realtime/{notification.notification_type}.txt",
183-
"notifications/email/realtime/body.txt",
183+
"notifications/email/realtime/message.txt",
184184
]
185185

186186
# Load subject

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "django-generic-notifications"
3-
version = "2.3.0"
3+
version = "2.3.1"
44
description = "A flexible, multi-channel notification system for Django applications with built-in support for email digests, user preferences, and extensible delivery channels."
55
authors = [
66
{name = "Kevin Renskers", email = "kevin@loopwerk.io"},

tests/test_channels.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ def render(self, context):
224224
def mock_select_side_effect(template_list):
225225
if "subject.txt" in template_list[1]:
226226
return MockTemplate("Fallback Subject")
227-
elif "body.html" in template_list[1]:
227+
elif "message.html" in template_list[1]:
228228
return MockTemplate("<html>Fallback HTML Body</html>")
229-
elif "body.txt" in template_list[1]:
229+
elif "message.txt" in template_list[1]:
230230
return MockTemplate("Fallback Text Body")
231231
raise TemplateDoesNotExist("No templates found")
232232

0 commit comments

Comments
 (0)