From c2f181984d3b63d9fe3e40b8c2763c75f24b161b Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 8 Aug 2024 13:00:54 +0200 Subject: [PATCH] Notifications: render the URL for account using Django template tag (#11521) * Notifications: render the URL using Django `url` template tag There is no need to pass this value as a `format_value` since we already have the organization and we can generate the URL using regular Django template tags. * Update tests * Notifications: render the URL for account using Django template tag Similar to https://github.com/readthedocs/readthedocs.org/pull/11465 --- readthedocs/api/v3/tests/responses/notifications-list.json | 2 +- .../api/v3/tests/responses/users-notifications-detail.json | 2 +- .../api/v3/tests/responses/users-notifications-list.json | 2 +- readthedocs/core/notifications.py | 2 +- readthedocs/notifications/signals.py | 4 ---- readthedocs/projects/views/private.py | 3 --- 6 files changed, 4 insertions(+), 11 deletions(-) diff --git a/readthedocs/api/v3/tests/responses/notifications-list.json b/readthedocs/api/v3/tests/responses/notifications-list.json index efd50f9bec9..c0526ffe178 100644 --- a/readthedocs/api/v3/tests/responses/notifications-list.json +++ b/readthedocs/api/v3/tests/responses/notifications-list.json @@ -48,7 +48,7 @@ "dismissable": false, "id": 4, "message": { - "body": "Your primary email address is not verified.\nPlease verify it here.", + "body": "Your primary email address is not verified.\nPlease verify it here.", "header": "Email address not verified", "icon_classes": "fas fa-circle-exclamation", "id": "core:email:validation-pending", diff --git a/readthedocs/api/v3/tests/responses/users-notifications-detail.json b/readthedocs/api/v3/tests/responses/users-notifications-detail.json index 565165fad99..8530452e641 100644 --- a/readthedocs/api/v3/tests/responses/users-notifications-detail.json +++ b/readthedocs/api/v3/tests/responses/users-notifications-detail.json @@ -7,7 +7,7 @@ "dismissable": false, "id": 4, "message": { - "body": "Your primary email address is not verified.\nPlease verify it here.", + "body": "Your primary email address is not verified.\nPlease verify it here.", "header": "Email address not verified", "icon_classes": "fas fa-circle-exclamation", "id": "core:email:validation-pending", diff --git a/readthedocs/api/v3/tests/responses/users-notifications-list.json b/readthedocs/api/v3/tests/responses/users-notifications-list.json index 23e46db5e7c..14487d8a748 100644 --- a/readthedocs/api/v3/tests/responses/users-notifications-list.json +++ b/readthedocs/api/v3/tests/responses/users-notifications-list.json @@ -12,7 +12,7 @@ "dismissable": false, "id": 4, "message": { - "body": "Your primary email address is not verified.\nPlease verify it here.", + "body": "Your primary email address is not verified.\nPlease verify it here.", "header": "Email address not verified", "icon_classes": "fas fa-circle-exclamation", "id": "core:email:validation-pending", diff --git a/readthedocs/core/notifications.py b/readthedocs/core/notifications.py index 853138bfc69..70405f3249f 100644 --- a/readthedocs/core/notifications.py +++ b/readthedocs/core/notifications.py @@ -17,7 +17,7 @@ textwrap.dedent( """ Your primary email address is not verified. - Please verify it here. + Please verify it here. """ ).strip(), ), diff --git a/readthedocs/notifications/signals.py b/readthedocs/notifications/signals.py index 313b9cfd90b..9cf09dd33a4 100644 --- a/readthedocs/notifications/signals.py +++ b/readthedocs/notifications/signals.py @@ -4,7 +4,6 @@ from allauth.account.models import EmailAddress from django.db.models.signals import post_save from django.dispatch import receiver -from django.urls import reverse from readthedocs.core.notifications import MESSAGE_EMAIL_VALIDATION_PENDING from readthedocs.notifications.models import Notification @@ -62,7 +61,4 @@ def user_email_verified(instance, *args, **kwargs): attached_to=instance.user, message_id=MESSAGE_EMAIL_VALIDATION_PENDING, dismissable=True, - format_values={ - "account_email_url": reverse("account_email"), - }, ) diff --git a/readthedocs/projects/views/private.py b/readthedocs/projects/views/private.py index ded5d25477d..15694ef5d2f 100644 --- a/readthedocs/projects/views/private.py +++ b/readthedocs/projects/views/private.py @@ -161,9 +161,6 @@ def validate_primary_email(self, user): attached_to=user, message_id=MESSAGE_EMAIL_VALIDATION_PENDING, dismissable=True, - format_values={ - "account_email_url": reverse("account_email"), - }, ) def get_queryset(self):