mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-10-31 22:19:00 +00:00
Merge branch 'main' into production
This commit is contained in:
commit
5651f83389
10 changed files with 31 additions and 52 deletions
|
@ -48,6 +48,7 @@ def moderation_report_email(report):
|
|||
if report.user:
|
||||
data["reportee"] = report.user.localname or report.user.username
|
||||
data["report_link"] = report.remote_id
|
||||
data["link_domain"] = report.links.exists()
|
||||
|
||||
for admin in models.User.objects.filter(
|
||||
groups__name__in=["admin", "moderator"]
|
||||
|
|
|
@ -147,6 +147,9 @@ LOGGING = {
|
|||
"require_debug_true": {
|
||||
"()": "django.utils.log.RequireDebugTrue",
|
||||
},
|
||||
"ignore_missing_variable": {
|
||||
"()": "bookwyrm.utils.log.IgnoreVariableDoesNotExist",
|
||||
},
|
||||
},
|
||||
"handlers": {
|
||||
# Overrides the default handler to make it log to console
|
||||
|
@ -154,6 +157,7 @@ LOGGING = {
|
|||
# console if DEBUG=False)
|
||||
"console": {
|
||||
"level": LOG_LEVEL,
|
||||
"filters": ["ignore_missing_variable"],
|
||||
"class": "logging.StreamHandler",
|
||||
},
|
||||
# This is copied as-is from the default logger, and is
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
{% block content %}
|
||||
<p>
|
||||
{% if report_link %}
|
||||
{% if link_domain %}
|
||||
|
||||
{% blocktrans trimmed %}
|
||||
@{{ reporter }} has flagged a link domain for moderation.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% load i18n %}
|
||||
{% block content %}
|
||||
|
||||
{% if report_link %}
|
||||
{% if link_domain %}
|
||||
{% blocktrans trimmed %}
|
||||
@{{ reporter }} has flagged a link domain for moderation.
|
||||
{% endblocktrans %}
|
||||
|
|
|
@ -192,53 +192,7 @@
|
|||
<p id="status-error-message" class="live-message notification is-danger p-3 pr-5 pl-5 is-hidden">{% trans "Error posting status" %}</p>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-one-fifth">
|
||||
<p>
|
||||
<a href="{% url 'about' %}">{% blocktrans with site_name=site.name %}About {{ site_name }}{% endblocktrans %}</a>
|
||||
</p>
|
||||
{% if site.admin_email %}
|
||||
<p>
|
||||
<a href="mailto:{{ site.admin_email }}">{% trans "Contact site admin" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
<a href="https://docs.joinbookwyrm.com/">{% trans "Documentation" %}</a>
|
||||
</p>
|
||||
{% if request.user.is_authenticated %}
|
||||
<p id="tour-begin">
|
||||
<a href="/guided-tour/True">{% trans "Guided Tour" %}</a>
|
||||
<noscript>(requires JavaScript)</noscript>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="column content is-two-fifth">
|
||||
{% if site.support_link %}
|
||||
<p>
|
||||
<span class="icon icon-heart"></span>
|
||||
{% blocktrans trimmed with site_name=site.name support_link=site.support_link support_title=site.support_title %}
|
||||
Support {{ site_name }} on
|
||||
<a href="{{ support_link }}" target="_blank" rel="nofollow noopener noreferrer">{{ support_title }}</a>
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
BookWyrm's source code is freely available. You can contribute or report issues on
|
||||
<a href="https://github.com/bookwyrm-social/bookwyrm" target="_blank" rel="nofollow noopener noreferrer">GitHub</a>.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
</div>
|
||||
{% if site.footer_item %}
|
||||
<div class="column">
|
||||
<p>{{ site.footer_item|safe }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{% include 'snippets/footer.html' %}
|
||||
{% endblock %}
|
||||
|
||||
<script>
|
||||
|
|
|
@ -44,6 +44,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'snippets/2fa_footer.html' %}
|
||||
{% include 'snippets/footer.html' %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -40,6 +40,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'snippets/2fa_footer.html' %}
|
||||
{% include 'snippets/footer.html' %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -297,7 +297,7 @@ urlpatterns = [
|
|||
name="settings-imports",
|
||||
),
|
||||
re_path(
|
||||
r"^settings/imports/(?P<import_id>\d+)/complete?$",
|
||||
r"^settings/imports/(?P<import_id>\d+)/complete/?$",
|
||||
views.ImportList.as_view(),
|
||||
name="settings-imports-complete",
|
||||
),
|
||||
|
|
20
bookwyrm/utils/log.py
Normal file
20
bookwyrm/utils/log.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
""" Logging utilities """
|
||||
import logging
|
||||
|
||||
|
||||
class IgnoreVariableDoesNotExist(logging.Filter):
|
||||
"""
|
||||
Filter to ignore VariableDoesNotExist errors
|
||||
|
||||
We intentionally pass nonexistent variables to templates a lot, so
|
||||
these errors are not useful to us.
|
||||
"""
|
||||
|
||||
def filter(self, record):
|
||||
if record.exc_info:
|
||||
(_, err_value, _) = record.exc_info
|
||||
while err_value:
|
||||
if type(err_value).__name__ == "VariableDoesNotExist":
|
||||
return False
|
||||
err_value = err_value.__context__
|
||||
return True
|
Loading…
Reference in a new issue