Skip to content

Notifications: fix rendering #11133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readthedocs/config/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
Config validation error in <code>{{key}}</code>.
Expected one of ({{choices}}), got type <code>{{value|to_class_name}}</code> (<code>{{value}}</code>).
Double check the type of the value.
A string may be required (e.g. <code>"3.10"</code> insted of <code>3.10</code>)
A string may be required (e.g. <code>"3.10"</code> instead of <code>3.10</code>)
"""
).strip(),
),
Expand Down
10 changes: 6 additions & 4 deletions readthedocs/notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.utils.translation import gettext_noop as _
from django_extensions.db.models import TimeStampedModel


from .constants import CANCELLED, DISMISSED, READ, UNREAD, WARNING
from .messages import Message, registry
from .querysets import NotificationQuerySet
Expand Down Expand Up @@ -67,9 +66,12 @@ def __str__(self):

def get_message(self):
# Pass the instance attached to this notification
format_values = {
"instance": self.attached_to,
}
format_values = self.format_values or {}
format_values.update(
{
"instance": self.attached_to,
}
)

message = registry.get(self.message_id, format_values=format_values)
if message is None:
Expand Down