Skip to content

NotificationDetailView does not use the NotificationType's template #1552

@felixrindt

Description

@felixrindt

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:

  1. Create an Event and send a NewEvent-Notification
  2. View the notification in it's detail view.
  3. 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.

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] bugSomething isn't working[P] minorfeatures or bugs that can wait for some more time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions