moviewyrm/bookwyrm/templates/settings/automod/rules.html

131 lines
4.7 KiB
HTML
Raw Normal View History

2022-02-24 19:18:43 +00:00
{% extends 'settings/layout.html' %}
{% load i18n %}
{% load utilities %}
{% block title %}
{% trans "Auto-moderation rules" %}
{% endblock %}
{% block header %}
{% trans "Auto-moderation rules" %}
{% endblock %}
{% block panel %}
<div class="notification content">
<p>
2022-02-25 01:42:28 +00:00
{% trans "Auto-moderation rules will create reports for any local user or status with fields matching the provided string." %}
2022-02-24 20:48:52 +00:00
{% trans "Users or statuses that have already been reported (regardless of whether the report was resolved) will not be flagged." %}
2022-02-24 19:18:43 +00:00
{% trans "At this time, reports are <em>not</em> being generated automatically, and you must manually trigger a scan." %}
</p>
2022-02-24 20:15:31 +00:00
<form name="run-scan" method="POST" action="{% url 'settings-automod-run' %}">
{% csrf_token %}
<button class="button is-warning">{% trans "Run scan" %}</button>
</form>
2022-02-24 19:18:43 +00:00
</div>
{% if success %}
<div class="notification is-success is-light">
<span class="icon icon-check" aria-hidden="true"></span>
<span>
{% trans "Successfully added rule" %}
</span>
</div>
{% endif %}
2022-02-25 01:34:02 +00:00
<div class="block content">
<h2 class="title is-4">{% trans "Add Rule" %}</h2>
<div class="box">
2022-02-24 19:18:43 +00:00
<form action="{% url 'settings-automod' %}" method="POST">
{% csrf_token %}
<input type="hidden" value="{{ request.user.id }}" name="created_by">
2022-02-25 01:34:02 +00:00
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="id_string_match">{% trans "String match" %}</label>
{{ form.string_match }}
{% include 'snippets/form_errors.html' with errors_list=form.string_match.errors id="desc_string_match" %}
</div>
</div>
<div class="column">
<div class="field">
<label class="label" for="id_flag_users">
{{ form.flag_users }}
{% trans "Flag users" %}
</label>
</div>
<div class="field">
<label class="label" for="id_flag_statuses">
{{ form.flag_statuses }}
{% trans "Flag statuses" %}
</label>
</div>
</div>
</div>
<div class="field">
<button type="submit" class="button is-primary">{% trans "Add rule" %}</button>
</div>
2022-02-24 19:18:43 +00:00
</form>
2022-02-25 01:34:02 +00:00
</div>
</div>
<div class="block content">
<h2 class="title is-4">{% trans "Current Rules" %}</h2>
<details class="details-panel">
<summary>
<span class="title is-5" role="heading" aria-level="3">
{% trans "Show rules" %} ({{ rules.count }})
</span>
<span class="details-close icon icon-x" aria-hidden="true"></span>
</summary>
<div class="table-container">
<table class="table is-striped">
<tr>
<th>
<label for="id_string_match">{% trans "String match" %}</label>
</th>
<th>
<label for="id_flag_users">{% trans "Flag users" %}</label>
</th>
<th>
<label for="id_flag_statuses">{% trans "Flag statuses" %}</label>
</th>
<th>
</th>
</tr>
{% for rule in rules %}
<tr>
<td>
<code>{{ rule.string_match }}</code>
</td>
<td>
{{ rule.flag_users|yesno }}
</td>
<td>
{{ rule.flag_statuses|yesno }}
</td>
<td>
<form action="{% url 'settings-automod-delete' rule.id %}" method="POST">
{% csrf_token %}
<div class="control">
<button type="submit" class="button is-danger is-light is-small">
<span class="icon icon-x m-0-mobile" aria-hidden="true"></span>
<span class="is-sr-only-mobile">{% trans "Remove rule" %}</span>
</button>
</div>
</form>
</td>
</tr>
{% endfor %}
</table>
</div>
</details>
2022-02-24 19:18:43 +00:00
</div>
{% endblock %}