Adds options to html validator and fixes dl/dts

This commit is contained in:
Mouse Reeve 2021-09-28 15:01:53 -07:00
parent 2befef7deb
commit ada3e1d4d6
3 changed files with 47 additions and 55 deletions

View file

@ -48,15 +48,12 @@
<div class="box content is-flex-grow-1"> <div class="box content is-flex-grow-1">
<dl> <dl>
{% if user.local %} {% if user.local %}
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Email:" %}</dt>
<dt>{% trans "Email:" %}</dt>
<dd>{{ user.email }}</dd> <dd>{{ user.email }}</dd>
</div>
{% endif %} {% endif %}
{% with report_count=user.report_set.count %} {% with report_count=user.report_set.count %}
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Reports:" %}</dt>
<dt>{% trans "Reports:" %}</dt>
<dd> <dd>
{{ report_count|intcomma }} {{ report_count|intcomma }}
{% if report_count > 0 %} {% if report_count > 0 %}
@ -65,41 +62,28 @@
</a> </a>
{% endif %} {% endif %}
</dd> </dd>
</div>
{% endwith %} {% endwith %}
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Blocked by count:" %}</dt>
<dt>{% trans "Blocked by count:" %}</dt>
<dd>{{ user.blocked_by.count }}</dd> <dd>{{ user.blocked_by.count }}</dd>
</div>
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Last active date:" %}</dt>
<dt>{% trans "Last active date:" %}</dt>
<dd>{{ user.last_active_date }}</dd> <dd>{{ user.last_active_date }}</dd>
</div>
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Manually approved followers:" %}</dt>
<dt>{% trans "Manually approved followers:" %}</dt>
<dd>{{ user.manually_approves_followers }}</dd> <dd>{{ user.manually_approves_followers }}</dd>
</div>
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Discoverable:" %}</dt>
<dt>{% trans "Discoverable:" %}</dt>
<dd>{{ user.discoverable }}</dd> <dd>{{ user.discoverable }}</dd>
</div>
{% if not user.is_active %} {% if not user.is_active %}
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Deactivation reason:" %}</dt>
<dt>{% trans "Deactivation reason:" %}</dt>
<dd>{{ user.deactivation_reason }}</dd> <dd>{{ user.deactivation_reason }}</dd>
</div>
{% endif %} {% endif %}
{% if not user.is_active and user.deactivation_reason == "pending" %} {% if not user.is_active and user.deactivation_reason == "pending" %}
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Confirmation code:" %}</dt>
<dt>{% trans "Confirmation code:" %}</dt>
<dd>{{ user.confirmation_code }}</dd> <dd>{{ user.confirmation_code }}</dd>
</div>
{% endif %} {% endif %}
</dl> </dl>
</div> </div>
@ -113,18 +97,14 @@
{% if server %} {% if server %}
<h5>{{ server.server_name }}</h5> <h5>{{ server.server_name }}</h5>
<dl> <dl>
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Software:" %}</dt>
<dt>{% trans "Software:" %}</dt>
<dd>{{ server.application_type }}</dd> <dd>{{ server.application_type }}</dd>
</div>
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Version:" %}</dt>
<dt>{% trans "Version:" %}</dt>
<dd>{{ server.application_version }}</dd> <dd>{{ server.application_version }}</dd>
</div>
<div class="is-flex"> <dt class="is-pulled-left mr-5">{% trans "Status:" %}</dt>
<dt>{% trans "Status:" %}</dt>
<dd>{{ server.status }}</dd> <dd>{{ server.status }}</dd>
</div>
</dl> </dl>
{% if server.notes %} {% if server.notes %}
<h5>{% trans "Notes" %}</h5> <h5>{% trans "Notes" %}</h5>

View file

@ -38,7 +38,7 @@ class IPBlocklistViews(TestCase):
self.assertIsInstance(result, TemplateResponse) self.assertIsInstance(result, TemplateResponse)
html = result.render() html = result.render()
_, errors = tidy_document(html.content) _, errors = tidy_document(html.content, options={"drop-empty-elements": False})
if errors: if errors:
raise Exception(errors) raise Exception(errors)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)

View file

@ -45,7 +45,13 @@ class ReportViews(TestCase):
result = view(request) result = view(request)
self.assertIsInstance(result, TemplateResponse) self.assertIsInstance(result, TemplateResponse)
html = result.render() html = result.render()
_, errors = tidy_document(html.content) _, errors = tidy_document(
html.content,
options={
"drop-empty-elements": False,
"warn-proprietary-attributes": False,
},
)
if errors: if errors:
raise Exception(errors) raise Exception(errors)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@ -61,7 +67,13 @@ class ReportViews(TestCase):
result = view(request) result = view(request)
self.assertIsInstance(result, TemplateResponse) self.assertIsInstance(result, TemplateResponse)
html = result.render() html = result.render()
_, errors = tidy_document(html.content) _, errors = tidy_document(
html.content,
options={
"drop-empty-elements": False,
"warn-proprietary-attributes": False,
},
)
if errors: if errors:
raise Exception(errors) raise Exception(errors)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
@ -78,7 +90,7 @@ class ReportViews(TestCase):
self.assertIsInstance(result, TemplateResponse) self.assertIsInstance(result, TemplateResponse)
html = result.render() html = result.render()
_, errors = tidy_document(html.content) _, errors = tidy_document(html.content, options={"drop-empty-elements": False})
if errors: if errors:
raise Exception(errors) raise Exception(errors)
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)