mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-28 19:10:35 +00:00
Merge branch 'main' into fwalloe-patch-1
This commit is contained in:
commit
ac17876cb6
3 changed files with 9 additions and 7 deletions
|
@ -12,7 +12,7 @@ from django.core.exceptions import ImproperlyConfigured
|
|||
env = Env()
|
||||
env.read_env()
|
||||
DOMAIN = env("DOMAIN")
|
||||
VERSION = "0.6.0"
|
||||
VERSION = "0.6.1"
|
||||
|
||||
RELEASE_API = env(
|
||||
"RELEASE_API",
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.views import View
|
|||
from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.views.helpers import redirect_to_referer
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
|
||||
|
||||
|
@ -57,7 +58,7 @@ class ImportList(View):
|
|||
"""Mark an import as complete"""
|
||||
import_job = get_object_or_404(models.ImportJob, id=import_id)
|
||||
import_job.stop_job()
|
||||
return redirect("settings-imports")
|
||||
return redirect_to_referer(request, "settings-imports")
|
||||
|
||||
|
||||
@require_POST
|
||||
|
|
|
@ -8,6 +8,7 @@ from django.utils.decorators import method_decorator
|
|||
from django.views import View
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.views.helpers import redirect_to_referer
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
|
||||
|
||||
|
@ -84,26 +85,26 @@ class ReportAdmin(View):
|
|||
|
||||
@login_required
|
||||
@permission_required("bookwyrm.moderate_user")
|
||||
def suspend_user(_, user_id):
|
||||
def suspend_user(request, user_id):
|
||||
"""mark an account as inactive"""
|
||||
user = get_object_or_404(models.User, id=user_id)
|
||||
user.is_active = False
|
||||
user.deactivation_reason = "moderator_suspension"
|
||||
# this isn't a full deletion, so we don't want to tell the world
|
||||
user.save(broadcast=False)
|
||||
return redirect("settings-user", user.id)
|
||||
return redirect_to_referer(request, "settings-user", user.id)
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required("bookwyrm.moderate_user")
|
||||
def unsuspend_user(_, user_id):
|
||||
def unsuspend_user(request, user_id):
|
||||
"""mark an account as inactive"""
|
||||
user = get_object_or_404(models.User, id=user_id)
|
||||
user.is_active = True
|
||||
user.deactivation_reason = None
|
||||
# this isn't a full deletion, so we don't want to tell the world
|
||||
user.save(broadcast=False)
|
||||
return redirect("settings-user", user.id)
|
||||
return redirect_to_referer(request, "settings-user", user.id)
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -123,7 +124,7 @@ def moderator_delete_user(request, user_id):
|
|||
if form.is_valid() and moderator.check_password(form.cleaned_data["password"]):
|
||||
user.deactivation_reason = "moderator_deletion"
|
||||
user.delete()
|
||||
return redirect("settings-user", user.id)
|
||||
return redirect_to_referer(request, "settings-user", user.id)
|
||||
|
||||
form.errors["password"] = ["Invalid password"]
|
||||
|
||||
|
|
Loading…
Reference in a new issue