mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 00:26:33 +00:00
Merge pull request #2202 from bookwyrm-social/settings-warnings
New and improved warnings on the admin dashboard
This commit is contained in:
commit
bd6774fca8
10 changed files with 132 additions and 45 deletions
|
@ -38,60 +38,39 @@
|
|||
|
||||
<div class="columns block is-multiline">
|
||||
{% if email_config_error %}
|
||||
<div class="column is-flex">
|
||||
<span class="notification is-warning is-block is-flex-grow-1">
|
||||
{% blocktrans trimmed %}
|
||||
Your outgoing email address, <code>{{ email_sender }}</code>, may be misconfigured.
|
||||
{% endblocktrans %}
|
||||
{% trans "Check the <code>EMAIL_SENDER_NAME</code> and <code>EMAIL_SENDER_DOMAIN</code> in your <code>.env</code>." %}
|
||||
</span>
|
||||
</div>
|
||||
{% include 'settings/dashboard/warnings/email_config.html' with warning_level="danger" fullwidth=True %}
|
||||
{% endif %}
|
||||
|
||||
{% if reports %}
|
||||
<div class="column is-flex">
|
||||
<a href="{% url 'settings-reports' %}" class="notification is-warning is-block is-flex-grow-1">
|
||||
{% blocktrans trimmed count counter=reports with display_count=reports|intcomma %}
|
||||
{{ display_count }} open report
|
||||
{% plural %}
|
||||
{{ display_count }} open reports
|
||||
{% endblocktrans %}
|
||||
</a>
|
||||
</div>
|
||||
{% if current_version %}
|
||||
{% include 'settings/dashboard/warnings/update_version.html' with warning_level="warning" fullwidth=True %}
|
||||
{% endif %}
|
||||
|
||||
{% if pending_domains %}
|
||||
<div class="column is-flex">
|
||||
<a href="{% url 'settings-link-domain' %}" class="notification is-primary is-block is-flex-grow-1">
|
||||
{% blocktrans trimmed count counter=pending_domains with display_count=pending_domains|intcomma %}
|
||||
{{ display_count }} domain needs review
|
||||
{% plural %}
|
||||
{{ display_count }} domains need review
|
||||
{% endblocktrans %}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if missing_privacy or missing_conduct %}
|
||||
<div class="column is-12 columns m-0 p-0">
|
||||
{% if missing_privacy %}
|
||||
{% include 'settings/dashboard/warnings/missing_privacy.html' with warning_level="danger" %}
|
||||
{% endif %}
|
||||
|
||||
{% if not site.allow_registration and site.allow_invite_requests and invite_requests %}
|
||||
<div class="column is-flex">
|
||||
<a href="{% url 'settings-invite-requests' %}" class="notification is-block is-success is-flex-grow-1">
|
||||
{% blocktrans trimmed count counter=invite_requests with display_count=invite_requests|intcomma %}
|
||||
{{ display_count }} invite request
|
||||
{% plural %}
|
||||
{{ display_count }} invite requests
|
||||
{% endblocktrans %}
|
||||
</a>
|
||||
{% if missing_conduct %}
|
||||
{% include 'settings/dashboard/warnings/missing_conduct.html' with warning_level="warning" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if current_version %}
|
||||
<div class="column is-flex">
|
||||
<a href="https://docs.joinbookwyrm.com/updating.html" class="notification is-block is-warning is-flex-grow-1" target="_blank">
|
||||
{% blocktrans trimmed with current=current_version available=available_version %}
|
||||
An update is available! You're running v{{ current }} and the latest release is {{ available }}.
|
||||
{% endblocktrans %}
|
||||
</a>
|
||||
</div>
|
||||
{% include 'settings/dashboard/warnings/update_version.html' with warning_level="warning" fullwidth=True %}
|
||||
{% endif %}
|
||||
|
||||
{% if reports %}
|
||||
{% include 'settings/dashboard/warnings/reports.html' with warning_level="warning" %}
|
||||
{% endif %}
|
||||
|
||||
{% if pending_domains %}
|
||||
{% include 'settings/dashboard/warnings/domain_review.html' with warning_level="primary" %}
|
||||
{% endif %}
|
||||
|
||||
{% if not site.allow_registration and site.allow_invite_requests and invite_requests %}
|
||||
{% include 'settings/dashboard/warnings/invites.html' with warning_level="success" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
{% extends 'settings/dashboard/warnings/layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block warning_link %}{% url 'settings-link-domain' %}{% endblock %}
|
||||
|
||||
{% block warning_text %}
|
||||
|
||||
{% blocktrans trimmed count counter=pending_domains with display_count=pending_domains|intcomma %}
|
||||
{{ display_count }} domain needs review
|
||||
{% plural %}
|
||||
{{ display_count }} domains need review
|
||||
{% endblocktrans %}
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'settings/dashboard/warnings/layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block warning_link %}https://docs.joinbookwyrm.com/install-prod.html{% endblock %}
|
||||
|
||||
{% block warning_text %}
|
||||
|
||||
{% blocktrans trimmed %}
|
||||
Your outgoing email address, <code>{{ email_sender }}</code>, may be misconfigured.
|
||||
{% endblocktrans %}
|
||||
{% trans "Check the <code>EMAIL_SENDER_NAME</code> and <code>EMAIL_SENDER_DOMAIN</code> in your <code>.env</code> file." %}
|
||||
|
||||
{% endblock %}
|
15
bookwyrm/templates/settings/dashboard/warnings/invites.html
Normal file
15
bookwyrm/templates/settings/dashboard/warnings/invites.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{% extends 'settings/dashboard/warnings/layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block warning_link %}{% url 'settings-invite-requests' %}{% endblock %}
|
||||
|
||||
{% block warning_text %}
|
||||
|
||||
{% blocktrans trimmed count counter=invite_requests with display_count=invite_requests|intcomma %}
|
||||
{{ display_count }} invite request
|
||||
{% plural %}
|
||||
{{ display_count }} invite requests
|
||||
{% endblocktrans %}
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,5 @@
|
|||
<div class="column is-flex{% if fullwidth %} is-12{% endif %}">
|
||||
<a href="{% block warning_link %}{% endblock %}" class="notification is-{{ warning_level }} is-block is-flex-grow-1">
|
||||
{% block warning_text %}{% endblock %}
|
||||
</a>
|
||||
</div>
|
|
@ -0,0 +1,10 @@
|
|||
{% extends 'settings/dashboard/warnings/layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block warning_link %}{% url 'settings-site' %}#instance-info{% endblock %}
|
||||
|
||||
{% block warning_text %}
|
||||
|
||||
{% trans "Your instance is missing a code of conduct." %}
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,10 @@
|
|||
{% extends 'settings/dashboard/warnings/layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block warning_link %}{% url 'settings-site' %}#instance-info{% endblock %}
|
||||
|
||||
{% block warning_text %}
|
||||
|
||||
{% trans "Your instance is missing a privacy policy." %}
|
||||
|
||||
{% endblock %}
|
15
bookwyrm/templates/settings/dashboard/warnings/reports.html
Normal file
15
bookwyrm/templates/settings/dashboard/warnings/reports.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{% extends 'settings/dashboard/warnings/layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block warning_link %}{% url 'settings-reports' %}{% endblock %}
|
||||
|
||||
{% block warning_text %}
|
||||
|
||||
{% blocktrans trimmed count counter=reports with display_count=reports|intcomma %}
|
||||
{{ display_count }} open report
|
||||
{% plural %}
|
||||
{{ display_count }} open reports
|
||||
{% endblocktrans %}
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,12 @@
|
|||
{% extends 'settings/dashboard/warnings/layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block warning_link %}https://docs.joinbookwyrm.com/updating.html{% endblock %}
|
||||
|
||||
{% block warning_text %}
|
||||
|
||||
{% blocktrans trimmed with current=current_version available=available_version %}
|
||||
An update is available! You're running v{{ current }} and the latest release is {{ available }}.
|
||||
{% endblocktrans %}
|
||||
|
||||
{% endblock %}
|
|
@ -42,6 +42,19 @@ class Dashboard(View):
|
|||
"email_sender"
|
||||
] = f"{settings.EMAIL_SENDER_NAME}@{settings.EMAIL_SENDER_DOMAIN}"
|
||||
|
||||
site = models.SiteSettings.objects.get()
|
||||
# pylint: disable=protected-access
|
||||
data["missing_conduct"] = (
|
||||
not site.code_of_conduct
|
||||
or site.code_of_conduct
|
||||
== site._meta.get_field("code_of_conduct").get_default()
|
||||
)
|
||||
data["missing_privacy"] = (
|
||||
not site.privacy_policy
|
||||
or site.privacy_policy
|
||||
== site._meta.get_field("privacy_policy").get_default()
|
||||
)
|
||||
|
||||
# check version
|
||||
try:
|
||||
release = get_data(settings.RELEASE_API, timeout=3)
|
||||
|
|
Loading…
Reference in a new issue