implement user moderation tools

This commit is contained in:
ghost 2023-10-09 19:31:25 +03:00
parent 42cef39589
commit 8d258c677b
5 changed files with 365 additions and 26 deletions

View file

@ -31,47 +31,95 @@
<table class="width-100">
<tbody>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">{{ 'Common'|trans }}</td>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Common'|trans }}</td>
</tr>
<tr>
<td class="padding-t-16-px">{{ 'Joined'|trans }}</td>
<td class="padding-t-16-px">{{ user.added | format_ago }}</td>
</tr>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">{{ 'Access'|trans }}</td>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Access'|trans }}</td>
</tr>
<tr>
<td class="padding-t-16-px">{{ 'Status'|trans }}</td>
<td class="padding-t-16-px">
{% if user.status %}
{{ 'active'|trans }}
{% else %}
{{ 'disabled'|trans }}
{% endif %}
{{ 'Status' | trans }}
</td>
<td class="padding-t-16-px">
{% if user.status %}
{{ 'Active' | trans }}
{% if user.moderator %}
<a class="float-right" href="{{ path('user_status_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/>
</svg>
</a>
{% endif %}
{% else %}
{{ 'Disabled' | trans }}
{% if user.moderator %}
<a class="float-right text-color-red" href="{{ path('user_status_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/>
</svg>
</a>
{% endif %}
{% endif %}
</td>
</tr>
<tr>
<td>{{ 'Approved'|trans }}</td>
<td>
{% if user.approved %}
{{ 'yes'|trans }}
{% else %}
{{ 'no'|trans }}
{% endif %}
{{ 'Approved' | trans }}
</td>
</tr>
<tr>
<td>{{ 'Moderator'|trans }}</td>
<td>
{% if user.moderator %}
{{ 'yes'|trans }}
{% else %}
{{ 'no'|trans }}
{% endif %}
{% if user.approved %}
{{ 'Yes'| trans }}
{% if user.moderator %}
<a class="float-right" href="{{ path('user_approved_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/>
</svg>
</a>
{% endif %}
{% else %}
{{ 'No'| trans }}
{% if user.moderator %}
<a class="float-right text-color-red" href="{{ path('user_approved_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/>
</svg>
</a>
{% endif %}
{% endif %}
</td>
</tr>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">{{ 'Settings'|trans }}</td>
<td>
{{ 'Moderator' | trans }}
</td>
<td>
{% if user.moderator %}
{{ 'Yes'| trans }}
{% if user.moderator %}
<a class="float-right" href="{{ path('user_moderator_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/>
</svg>
</a>
{% endif %}
{% else %}
{{ 'No'| trans }}
{% if user.moderator %}
<a class="float-right text-color-red" href="{{ path('user_moderator_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/>
</svg>
</a>
{% endif %}
{% endif %}
</td>
</tr>
<tr>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Settings'|trans }}</td>
</tr>
<tr>
<td class="padding-t-16-px">{{ 'Interface'|trans }}</td>
@ -81,7 +129,7 @@
</tr>
<tr>
<td class="width-20">{{ 'Content'|trans }}</td>
<td class="width-80">
<td class="width-80 line-height-20-px">
{% for i, locale in user.locales %}{% if i > 0 %},{% endif %} {{ locale|locale_name(locale)|u.title }}{% endfor %}
{#
{% for locale in user.locales %}
@ -100,9 +148,9 @@
<td>{{ 'Sensitive'|trans }}</td>
<td>
{% if user.sensitive %}
{{ 'yes'|trans }}
{{ 'Yes'|trans }}
{% else %}
{{ 'no'|trans }}
{{ 'No'|trans }}
{% endif %}
</td>
</tr>