-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Describe the bug
When rendering a notification, e.g. for a NewEvent, the template of the type is not used in NotificationDetailView, leading to display not in correspondance with email content.
To Reproduce
Steps to reproduce the behavior:
- Create an Event and send a NewEvent-Notification
- View the notification in it's detail view.
- See missing event date and time information
Expected behavior
The content should be shown in full as templated in the Notifcation Type.
Additional info
To fix this might need some refactoring, as the template currently contains the whole email, not just the actual notification content parts. With content only inside the template, NewEventNotificationType is inconsistent with it's plaintext not containing any date/time info.
ephios/ephios/core/services/notifications/types.py
Lines 207 to 218 in 7a7a4e1
| @classmethod | |
| def get_body(cls, notification): | |
| event = Event.objects.get(pk=notification.data.get("event_id")) | |
| return _( | |
| "A new {type} ({title}, {location}) has been added.\n" | |
| "Further information: {description}" | |
| ).format( | |
| type=event.type, | |
| title=event.title, | |
| location=event.location, | |
| description=event.description, | |
| ) |
I'd suggest changing the role of the notification type template. It should only apply to the body of the mail where the plaintext is rendered into. That way, we could render the body alone for displaying notifications in the browser as well.