diff --git a/src/openforms/conf/locale/nl/LC_MESSAGES/django.po b/src/openforms/conf/locale/nl/LC_MESSAGES/django.po index 934a6b03dc..fd4e72b27e 100644 --- a/src/openforms/conf/locale/nl/LC_MESSAGES/django.po +++ b/src/openforms/conf/locale/nl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Forms\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-22 12:22+0200\n" +"POT-Creation-Date: 2024-05-23 10:18+0200\n" "PO-Revision-Date: 2024-05-17 15:22+0200\n" "Last-Translator: Sergei Maertens \n" "Language-Team: Dutch \n" @@ -2187,36 +2187,36 @@ msgstr "Lijst van beschikbare stijlen" msgid "Retrieve theme details" msgstr "Stijldetails weergeven" -#: openforms/config/checks.py:54 +#: openforms/config/checks.py:56 msgid "Address lookup plugins" msgstr "Adresopzoekplugins" -#: openforms/config/checks.py:67 +#: openforms/config/checks.py:69 msgid "Validator plugins" msgstr "Validatieplugins" -#: openforms/config/checks.py:78 +#: openforms/config/checks.py:80 msgid "Appointment plugins" msgstr "Afspraakplugins" -#: openforms/config/checks.py:79 +#: openforms/config/checks.py:81 msgid "Registration plugins" msgstr "Registratieplugins" -#: openforms/config/checks.py:80 +#: openforms/config/checks.py:82 #: openforms/emails/templates/emails/admin_digest.html:46 msgid "Prefill plugins" msgstr "Prefillplugins" -#: openforms/config/checks.py:81 +#: openforms/config/checks.py:83 msgid "Payment plugins" msgstr "Betaalproviderplugins" -#: openforms/config/checks.py:82 +#: openforms/config/checks.py:84 msgid "DMN plugins" msgstr "DMN plugins" -#: openforms/config/checks.py:126 +#: openforms/config/checks.py:130 #, python-brace-format msgid "Internal error: {exception}" msgstr "Interne fout: {exception}" @@ -3824,29 +3824,29 @@ msgstr "Bevestiging" msgid "Co-sign confirmation" msgstr "Mede-ondertekeningbevestiging" -#: openforms/emails/digest.py:239 +#: openforms/emails/digest.py:247 msgid "BRK Client" msgstr "BRK client" -#: openforms/emails/digest.py:246 +#: openforms/emails/digest.py:254 #, fuzzy #| msgid "BRK Client" msgid "BAG Client" msgstr "BRK client" -#: openforms/emails/digest.py:256 +#: openforms/emails/digest.py:264 msgid "will expire soon" msgstr "" -#: openforms/emails/digest.py:257 +#: openforms/emails/digest.py:265 msgid "has invalid keypair" msgstr "" -#: openforms/emails/digest.py:258 +#: openforms/emails/digest.py:266 msgid "invalid keypair, will expire soon" msgstr "" -#: openforms/emails/digest.py:351 +#: openforms/emails/digest.py:359 #, fuzzy #| msgid "Email registration configuration" msgid "Invalid registration backend configuration detected" diff --git a/src/openforms/emails/digest.py b/src/openforms/emails/digest.py index 65100e2f9a..1400a9944d 100644 --- a/src/openforms/emails/digest.py +++ b/src/openforms/emails/digest.py @@ -30,6 +30,7 @@ from openforms.typing import StrOrPromise from openforms.utils.json_logic.datastructures import InputVar from openforms.utils.json_logic.introspection import introspect_json_logic +from openforms.utils.urls import build_absolute_uri from openforms.variables.constants import FormVariableDataTypes from openforms.variables.service import get_static_variables @@ -71,10 +72,12 @@ def admin_link(self) -> str: "object_id__in": ",".join(self.submission_ids), "extra_data__log_event__in": "prefill_retrieve_empty,prefill_retrieve_failure", } - submissions_admin_url = furl( + submissions_relative_admin_url = furl( reverse("admin:logging_timelinelogproxy_changelist") ) - return submissions_admin_url.add(query_params).url + submissions_relative_admin_url.add(query_params) + + return build_absolute_uri(submissions_relative_admin_url.url) @property def failed_submissions_counter(self) -> int: @@ -97,11 +100,12 @@ class InvalidCertificate: @property def admin_link(self) -> str: - form_admin_url = reverse( + form_relative_admin_url = reverse( "admin:simple_certmanager_certificate_change", kwargs={"object_id": self.id}, ) - return form_admin_url + + return build_absolute_uri(form_relative_admin_url) @dataclass @@ -113,10 +117,10 @@ class InvalidRegistrationBackend: @property def admin_link(self) -> str: - form_admin_url = reverse( + form_relative_admin_url = reverse( "admin:forms_form_change", kwargs={"object_id": self.form_id} ) - return form_admin_url + return build_absolute_uri(form_relative_admin_url) @dataclass @@ -127,7 +131,11 @@ class InvalidLogicRule: @property def admin_link(self) -> str: - return reverse("admin:forms_form_change", kwargs={"object_id": self.form_id}) + form_relative_admin_url = reverse( + "admin:forms_form_change", kwargs={"object_id": self.form_id} + ) + + return build_absolute_uri(form_relative_admin_url) def collect_failed_emails(since: datetime) -> Iterable[FailedEmail]: @@ -289,7 +297,7 @@ def collect_invalid_certificates() -> list[InvalidCertificate]: invalid_certs.append( InvalidCertificate( id=cert.id, - label=cert.label, + label=str(cert), error_message=error_message, is_valid_pair=is_valid_pair, expiry_date=cert.expiry_date, diff --git a/src/openforms/emails/tests/test_tasks_integration.py b/src/openforms/emails/tests/test_tasks_integration.py index 14b145e43b..0ab66f2741 100644 --- a/src/openforms/emails/tests/test_tasks_integration.py +++ b/src/openforms/emails/tests/test_tasks_integration.py @@ -121,6 +121,7 @@ def test_no_email_sent_if_no_recipients(self, mock_global_config): return_value=BRKConfig(service=None), ) @freeze_time("2023-01-03T01:00:00+01:00") + @override_settings(BASE_URL="http://testserver") def test_email_sent_when_there_are_failures(self, mock_global_config, brk_config): """Integration test for all the possible failures @@ -187,7 +188,7 @@ def test_email_sent_when_there_are_failures(self, mock_global_config, brk_config open(TEST_FILES / "test.key", "r") as key_f, ): certificate = CertificateFactory.create( - label="Test certificate", + label="", public_certificate=File( client_certificate_f, name="test.certificate" ), @@ -207,35 +208,41 @@ def test_email_sent_when_there_are_failures(self, mock_global_config, brk_config ) with self.subTest("failed registration"): - admin_submissions_url = furl( + admin_relative_submissions_url = furl( reverse("admin:submissions_submission_changelist") ) - admin_submissions_url.args = { + admin_relative_submissions_url.args = { "form__id__exact": form.id, "needs_on_completion_retry__exact": 1, "registration_time": "24hAgo", } + admin_submissions_url = furl( + f"http://testserver{admin_relative_submissions_url.url}" + ).url self.assertIn( f"Form '{form.admin_name}' failed 1 time(s) between 12:30 p.m. and 12:30 p.m..", sent_email.body, ) - self.assertIn(admin_submissions_url.url, sent_email.body) + self.assertIn(admin_submissions_url, sent_email.body) with self.subTest("failed prefill plugin"): content_type = ContentType.objects.get_for_model(Submission).id - admin_logs_url = furl(reverse("admin:logging_timelinelogproxy_changelist")) - admin_logs_url.args = { + admin_relative_logs_url = furl( + reverse("admin:logging_timelinelogproxy_changelist") + ) + admin_relative_logs_url.args = { "content_type": content_type, "object_id__in": submission.id, "extra_data__log_event__in": "prefill_retrieve_empty,prefill_retrieve_failure", } + admin_logs_url = furl(f"http://testserver{admin_relative_logs_url.url}").url self.assertIn( f"'{hc_plugin.verbose_name}' plugin has failed 1 time(s) between 12:30 p.m. and 12:30 p.m.", sent_email.body, ) - self.assertIn(admin_logs_url.url, sent_email.body) + self.assertIn(admin_logs_url, sent_email.body) with self.subTest("broken configuration"): self.assertIn( @@ -244,20 +251,21 @@ def test_email_sent_when_there_are_failures(self, mock_global_config, brk_config ) with self.subTest("invalid certificates"): - admin_certificate_url = furl( - reverse( - "admin:simple_certmanager_certificate_change", - kwargs={"object_id": certificate.id}, - ) + admin_relative_certificate_url = reverse( + "admin:simple_certmanager_certificate_change", + kwargs={"object_id": certificate.id}, ) + admin_certificate_url = f"http://testserver{admin_relative_certificate_url}" - self.assertIn("Test certificate: has invalid keypair.", sent_email.body) - self.assertIn(admin_certificate_url.url, sent_email.body) + self.assertIn("(missing label): has invalid keypair.", sent_email.body) + self.assertIn(admin_certificate_url, sent_email.body) with self.subTest("invalid registration backends"): - admin_form_url = reverse( + admin_relative_form_url = reverse( "admin:forms_form_change", kwargs={"object_id": form.id} ) + admin_form_url = f"http://testserver{admin_relative_form_url}" + self.assertIn( f"The configuration for plugin '{InvalidBackend.verbose_name}' is invalid.", sent_email.body, diff --git a/src/openforms/submissions/utils.py b/src/openforms/submissions/utils.py index a6fc0b2004..7f177625f4 100644 --- a/src/openforms/submissions/utils.py +++ b/src/openforms/submissions/utils.py @@ -25,6 +25,7 @@ ) from openforms.forms.models import Form from openforms.logging import logevent +from openforms.utils.urls import build_absolute_uri from openforms.variables.constants import FormVariableSources from .constants import SUBMISSIONS_SESSION_KEY, UPLOADS_SESSION_KEY @@ -346,5 +347,9 @@ def get_filtered_submission_admin_url( "needs_on_completion_retry__exact": 1 if filter_retry else 0, "registration_time": registration_time, } - submissions_admin_url = furl(reverse("admin:submissions_submission_changelist")) - return submissions_admin_url.add(query_params).url + submissions_relative_admin_url = furl( + reverse("admin:submissions_submission_changelist") + ) + submissions_relative_admin_url.add(query_params) + + return build_absolute_uri(submissions_relative_admin_url.url)