Changes language from "deactivate" to "suspend"

This commit is contained in:
Mouse Reeve 2021-04-19 15:51:39 -07:00
parent 1542866b6c
commit da19089d34
5 changed files with 15 additions and 13 deletions

View file

@ -5,12 +5,12 @@
<p class="mr-1">
<a class="button" href="{% url 'direct-messages-user' user.username %}">{% trans "Send direct message" %}</a>
</p>
<form name="deactivate" method="post" action="">
<form name="suspend" method="post" action="{% url 'settings-report-suspend' user.id %}">
{% csrf_token %}
{% if user.is_active %}
<button type="submit" class="button is-danger is-light">{% trans "Deactivate user" %}</button>
<button type="submit" class="button is-danger is-light">{% trans "Suspend user" %}</button>
{% else %}
<button class="button">{% trans "Reactivate user" %}</button>
<button class="button">{% trans "Un-suspend user" %}</button>
{% endif %}
</form>
</div>

View file

@ -63,7 +63,7 @@ urlpatterns = [
re_path(
r"^settings/users/(?P<user>\d+)/?$",
views.UserAdmin.as_view(),
name="settings-user"
name="settings-user",
),
re_path(
r"^settings/federation/?$",
@ -120,9 +120,9 @@ urlpatterns = [
name="settings-report",
),
re_path(
r"^settings/reports/(?P<report_id>\d+)/deactivate/?$",
views.deactivate_user,
name="settings-report-deactivate",
r"^settings/reports/(?P<user_id>\d+)/suspend/?$",
views.suspend_user,
name="settings-report-suspend",
),
re_path(
r"^settings/reports/(?P<report_id>\d+)/resolve/?$",

View file

@ -25,7 +25,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, deactivate_user
from .reports import Report, Reports, make_report, resolve_report, suspend_user
from .rss_feed import RssFeed
from .password import PasswordResetRequest, PasswordReset, ChangePassword
from .search import Search

View file

@ -74,12 +74,13 @@ class Report(View):
@login_required
@permission_required("bookwyrm_moderate_user")
def deactivate_user(_, report_id):
def suspend_user(_, user_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)
user = get_object_or_404(models.User, id=user_id)
user.is_active = not user.is_active
# 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)
@login_required

View file

@ -57,6 +57,7 @@ class UserAdminList(View):
}
return TemplateResponse(request, "user_admin/user_admin.html", data)
@method_decorator(login_required, name="dispatch")
@method_decorator(
permission_required("bookwyrm.moderate_users", raise_exception=True),