mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Merge branch 'main' into footer-links
This commit is contained in:
commit
85337c73e5
6 changed files with 28 additions and 3 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 %}
|
||||
|
|
|
@ -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