Add mastodon verification link

This commit is contained in:
Jake Howard 2023-07-02 17:18:57 +01:00
parent a5d5f828c0
commit f90c25d132
Signed by: jake
GPG key ID: 57AFB45680EDD477
6 changed files with 25 additions and 7 deletions

View file

@ -17,7 +17,7 @@ class BlogPostPageTestCase(TestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
def test_queries(self) -> None: def test_queries(self) -> None:
with self.assertNumQueries(47): with self.assertNumQueries(48):
self.client.get(self.page.url) self.client.get(self.page.url)
@ -76,7 +76,7 @@ class BlogPostListPageTestCase(TestCase):
self.assertContains(response, self.page.reverse_subpage("feed")) self.assertContains(response, self.page.reverse_subpage("feed"))
def test_queries(self) -> None: def test_queries(self) -> None:
with self.assertNumQueries(44): with self.assertNumQueries(45):
self.client.get(self.page.url) self.client.get(self.page.url)
def test_feed_accessible(self) -> None: def test_feed_accessible(self) -> None:

View file

@ -1,4 +1,4 @@
{% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags plausible_wagtail favicon_tags sri cache %} {% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags plausible_wagtail favicon_tags sri cache contact_tags %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-GB"> <html lang="en-GB">
@ -16,6 +16,8 @@
<link rel="alternate" type="application/rss+xml" href="{% url 'feed' %}" /> <link rel="alternate" type="application/rss+xml" href="{% url 'feed' %}" />
{% mastodon_link %}
<script async type="text/javascript" src="{% static 'js/ie11-deterrent.js' %}" integrity="{% sri_integrity_static 'js/ie11-deterrent.js' %}"></script> <script async type="text/javascript" src="{% static 'js/ie11-deterrent.js' %}" integrity="{% sri_integrity_static 'js/ie11-deterrent.js' %}"></script>
{% sri_static "css/base.css" %} {% sri_static "css/base.css" %}

View file

@ -35,7 +35,7 @@ class ContentPageTestCase(TestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
def test_queries(self) -> None: def test_queries(self) -> None:
with self.assertNumQueries(38): with self.assertNumQueries(39):
self.client.get(self.page.url) self.client.get(self.page.url)
@ -52,7 +52,7 @@ class ListingPageTestCase(TestCase):
ContentPageFactory(parent=cls.page) ContentPageFactory(parent=cls.page)
def test_accessible(self) -> None: def test_accessible(self) -> None:
with self.assertNumQueries(42): with self.assertNumQueries(43):
response = self.client.get(self.page.url) response = self.client.get(self.page.url)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.context["listing_pages"]), 2) self.assertEqual(len(response.context["listing_pages"]), 2)

View file

@ -22,7 +22,7 @@ class Error404PageTestCase(TestCase):
) )
def test_queries(self) -> None: def test_queries(self) -> None:
with self.assertNumQueries(22): with self.assertNumQueries(23):
self.client.get(self.url) self.client.get(self.url)

View file

@ -0,0 +1,16 @@
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('<link rel="me" href="{}" />', mastodon_account.url)

View file

@ -89,7 +89,7 @@ class SearchPageResultsTestCase(TestCase):
) )
def test_too_high_page(self) -> None: def test_too_high_page(self) -> None:
with self.assertNumQueries(47): with self.assertNumQueries(48):
response = self.client.get( response = self.client.get(
self.url, {"q": "post", "page": 3}, HTTP_HX_REQUEST="true" self.url, {"q": "post", "page": 3}, HTTP_HX_REQUEST="true"
) )