Skip to content

Commit e7849c7

Browse files
authored
Notifications: fix rendering (#11133)
* Notifications: fix rendering In #11094 we introduce a bug in the rendering because we stopped initializing the Message class with the `format_values` from the `Notification` object itself. That's why all the notifications weren't rendering these values. * Notifications: typo
1 parent 06140a3 commit e7849c7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

readthedocs/config/notifications.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
Config validation error in <code>{{key}}</code>.
266266
Expected one of ({{choices}}), got type <code>{{value|to_class_name}}</code> (<code>{{value}}</code>).
267267
Double check the type of the value.
268-
A string may be required (e.g. <code>"3.10"</code> insted of <code>3.10</code>)
268+
A string may be required (e.g. <code>"3.10"</code> instead of <code>3.10</code>)
269269
"""
270270
).strip(),
271271
),

readthedocs/notifications/models.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from django.utils.translation import gettext_noop as _
88
from django_extensions.db.models import TimeStampedModel
99

10-
1110
from .constants import CANCELLED, DISMISSED, READ, UNREAD, WARNING
1211
from .messages import Message, registry
1312
from .querysets import NotificationQuerySet
@@ -67,9 +66,12 @@ def __str__(self):
6766

6867
def get_message(self):
6968
# Pass the instance attached to this notification
70-
format_values = {
71-
"instance": self.attached_to,
72-
}
69+
format_values = self.format_values or {}
70+
format_values.update(
71+
{
72+
"instance": self.attached_to,
73+
}
74+
)
7375

7476
message = registry.get(self.message_id, format_values=format_values)
7577
if message is None:

0 commit comments

Comments
 (0)