From 87c7e4ab398cd38bbd99faa3e59ea47d28ea20eb Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 21 Feb 2024 20:14:27 +0100 Subject: [PATCH 1/2] 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. --- readthedocs/notifications/models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/readthedocs/notifications/models.py b/readthedocs/notifications/models.py index f583e0a99f8..54ad480f431 100644 --- a/readthedocs/notifications/models.py +++ b/readthedocs/notifications/models.py @@ -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 @@ -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: From 2acaae513a70719e4ffb6c26c1cf257651996484 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 21 Feb 2024 20:15:39 +0100 Subject: [PATCH 2/2] Notifications: typo --- readthedocs/config/notifications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/config/notifications.py b/readthedocs/config/notifications.py index b6f744c6af0..c43c148edb6 100644 --- a/readthedocs/config/notifications.py +++ b/readthedocs/config/notifications.py @@ -265,7 +265,7 @@ Config validation error in {{key}}. Expected one of ({{choices}}), got type {{value|to_class_name}} ({{value}}). Double check the type of the value. - A string may be required (e.g. "3.10" insted of 3.10) + A string may be required (e.g. "3.10" instead of 3.10) """ ).strip(), ),