Skip to content

Commit aabfd05

Browse files
committed
Drop "Unknown message" notification
- Closes #11482
1 parent fa55fc1 commit aabfd05

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

readthedocs/notifications/models.py

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import textwrap
2-
31
import structlog
42
from django.contrib.contenttypes.fields import GenericForeignKey
53
from django.contrib.contenttypes.models import ContentType
@@ -8,8 +6,8 @@
86
from django.utils.translation import gettext_noop as _
97
from django_extensions.db.models import TimeStampedModel
108

11-
from .constants import CANCELLED, DISMISSED, READ, UNREAD, WARNING
12-
from .messages import Message, registry
9+
from .constants import CANCELLED, DISMISSED, READ, UNREAD
10+
from .messages import registry
1311
from .querysets import NotificationQuerySet
1412

1513
log = structlog.get_logger(__name__)
@@ -76,24 +74,11 @@ def get_message(self):
7674

7775
message = registry.get(self.message_id, format_values=format_values)
7876
if message is None:
79-
# Log the error and return an unknown error to avoid breaking the response.
77+
# Log the error and let the None message return through the API
8078
log.error(
8179
"The message ID retrieved is not in our registry anymore.",
8280
message_id=self.message_id,
8381
)
84-
return Message(
85-
id="unknown-message",
86-
header=_("Unknown message"),
87-
body=_(
88-
textwrap.dedent(
89-
"""
90-
It seems it was an old message,
91-
and is not in our registry anymore.
92-
"""
93-
).strip(),
94-
),
95-
type=WARNING,
96-
)
9782

9883
return message
9984

0 commit comments

Comments
 (0)