From 7105386e619f4ef5c527133c0c363624cf016684 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 20 Jul 2023 22:02:02 +0100 Subject: [PATCH] Use direct mastodon host for verification --- website/blog/tests.py | 4 ++-- website/common/templates/base.html | 4 ++-- website/common/tests/test_pages.py | 4 ++-- website/common/tests/test_views.py | 2 +- website/contact/templatetags/contact_tags.py | 16 ---------------- website/search/tests.py | 2 +- website/utils/context_processors.py | 1 + 7 files changed, 9 insertions(+), 24 deletions(-) delete mode 100644 website/contact/templatetags/contact_tags.py diff --git a/website/blog/tests.py b/website/blog/tests.py index 74b103b..bdd6b9e 100644 --- a/website/blog/tests.py +++ b/website/blog/tests.py @@ -17,7 +17,7 @@ class BlogPostPageTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_queries(self) -> None: - with self.assertNumQueries(48): + with self.assertNumQueries(47): self.client.get(self.page.url) @@ -76,7 +76,7 @@ class BlogPostListPageTestCase(TestCase): self.assertContains(response, self.page.reverse_subpage("feed")) def test_queries(self) -> None: - with self.assertNumQueries(45): + with self.assertNumQueries(44): self.client.get(self.page.url) def test_feed_accessible(self) -> None: diff --git a/website/common/templates/base.html b/website/common/templates/base.html index ab944b7..4626efe 100644 --- a/website/common/templates/base.html +++ b/website/common/templates/base.html @@ -1,4 +1,4 @@ -{% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags plausible_wagtail favicon_tags sri cache contact_tags %} +{% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags plausible_wagtail favicon_tags sri cache %} @@ -16,7 +16,7 @@ - {% mastodon_link %} + diff --git a/website/common/tests/test_pages.py b/website/common/tests/test_pages.py index cda22cb..1470f67 100644 --- a/website/common/tests/test_pages.py +++ b/website/common/tests/test_pages.py @@ -35,7 +35,7 @@ class ContentPageTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_queries(self) -> None: - with self.assertNumQueries(39): + with self.assertNumQueries(38): self.client.get(self.page.url) @@ -52,7 +52,7 @@ class ListingPageTestCase(TestCase): ContentPageFactory(parent=cls.page) def test_accessible(self) -> None: - with self.assertNumQueries(43): + with self.assertNumQueries(42): response = self.client.get(self.page.url) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.context["listing_pages"]), 2) diff --git a/website/common/tests/test_views.py b/website/common/tests/test_views.py index c4aa1aa..ac3deaf 100644 --- a/website/common/tests/test_views.py +++ b/website/common/tests/test_views.py @@ -22,7 +22,7 @@ class Error404PageTestCase(TestCase): ) def test_queries(self) -> None: - with self.assertNumQueries(23): + with self.assertNumQueries(22): self.client.get(self.url) diff --git a/website/contact/templatetags/contact_tags.py b/website/contact/templatetags/contact_tags.py deleted file mode 100644 index 77a53f1..0000000 --- a/website/contact/templatetags/contact_tags.py +++ /dev/null @@ -1,16 +0,0 @@ -from django.template import Library -from django.utils.html import format_html - -from website.contact.models import OnlineAccount - -register = Library() - - -@register.simple_tag() -def mastodon_link() -> str: - mastodon_account = OnlineAccount.objects.filter(name__iexact="mastodon").first() - - if mastodon_account is None: - return "" - - return format_html('', mastodon_account.url) diff --git a/website/search/tests.py b/website/search/tests.py index 860c6ca..01f51fa 100644 --- a/website/search/tests.py +++ b/website/search/tests.py @@ -89,7 +89,7 @@ class SearchPageResultsTestCase(TestCase): ) def test_too_high_page(self) -> None: - with self.assertNumQueries(48): + with self.assertNumQueries(47): response = self.client.get( self.url, {"q": "post", "page": 3}, HTTP_HX_REQUEST="true" ) diff --git a/website/utils/context_processors.py b/website/utils/context_processors.py index 6f6099e..1406632 100644 --- a/website/utils/context_processors.py +++ b/website/utils/context_processors.py @@ -10,4 +10,5 @@ def global_vars(request: HttpRequest) -> dict: "DEBUG": settings.DEBUG, "FRAGMENT_CACHE_TTL": fragment_cache_ttl, "FRAGMENT_CACHE_TTL_JITTER": fragment_cache_ttl * 0.1, + "ACTIVITYPUB_HOST": settings.ACTIVITYPUB_HOST, }