Option to deactivate reported users

This commit is contained in:
Mouse Reeve
2021-03-12 11:13:53 -08:00
parent 422cd2da73
commit 677a49fee3
6 changed files with 52 additions and 6 deletions

View File

@ -20,7 +20,7 @@ from .notifications import Notifications
from .outbox import Outbox
from .reading import edit_readthrough, create_readthrough, delete_readthrough
from .reading import start_reading, finish_reading, delete_progressupdate
from .reports import Report, Reports, make_report, resolve_report
from .reports import Report, Reports, make_report, resolve_report, deactivate_user
from .rss_feed import RssFeed
from .password import PasswordResetRequest, PasswordReset, ChangePassword
from .search import Search

View File

@ -50,6 +50,16 @@ class Report(View):
return TemplateResponse(request, "moderation/report.html", data)
@login_required
@permission_required("bookwyrm_moderate_user")
def deactivate_user(_, report_id):
""" mark an account as inactive """
report = get_object_or_404(models.Report, id=report_id)
report.user.is_active = not report.user.is_active
report.user.save()
return redirect("settings-report", report.id)
@login_required
@permission_required("bookwyrm_moderate_post")
def resolve_report(_, report_id):