Allow users to report spam links
This commit is contained in:
parent
651d468b13
commit
78dd5caf9f
20 changed files with 310 additions and 151 deletions
|
@ -1,5 +1,4 @@
|
|||
{% extends 'settings/layout.html' %}
|
||||
{% load humanize %}
|
||||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
|
||||
|
@ -32,7 +31,7 @@
|
|||
|
||||
{% for domain in domains %}
|
||||
{% join "domain" domain.id as domain_modal %}
|
||||
<div class="box content">
|
||||
<div class="box content" id="{{ domain.id }}">
|
||||
<div class="columns is-mobile">
|
||||
<header class="column">
|
||||
<h2 class="title is-5">
|
||||
|
@ -58,37 +57,7 @@
|
|||
</summary>
|
||||
|
||||
<div class="table-container mt-4">
|
||||
<table class="is-striped">
|
||||
<tr>
|
||||
<th>{% trans "URL" %}</th>
|
||||
<th>{% trans "Added by" %}</th>
|
||||
<th>{% trans "Filetype" %}</th>
|
||||
<th>{% trans "Book" %}</th>
|
||||
</tr>
|
||||
{% for link in domain.links.all|slice:10 %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ link.url }}" target="_blank" rel="noopener">{{ link.url }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'settings-user' link.added_by.id %}">@{{ link.added_by|username }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if link.filelink.filetype %}
|
||||
{{ link.filelink.filetype }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% if link.filelink.filetype %}
|
||||
{% with book=link.filelink.book %}
|
||||
<a href="{{ book.local_path }}">{% include "snippets/book_titleby.html" with book=book %}</a>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% include "settings/link_domains/link_table.html" with links=domain.links.all|slice:10 %}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
|
36
bookwyrm/templates/settings/link_domains/link_table.html
Normal file
36
bookwyrm/templates/settings/link_domains/link_table.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
|
||||
<table class="is-striped">
|
||||
<tr>
|
||||
<th>{% trans "URL" %}</th>
|
||||
<th>{% trans "Added by" %}</th>
|
||||
<th>{% trans "Filetype" %}</th>
|
||||
<th>{% trans "Book" %}</th>
|
||||
{% block additional_headers %}{% endblock %}
|
||||
</tr>
|
||||
{% for link in links%}
|
||||
<tr>
|
||||
<td class="overflow-wrap-anywhere">
|
||||
<a href="{{ link.url }}" target="_blank" rel="noopener">{{ link.url }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'settings-user' link.added_by.id %}">@{{ link.added_by|username }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if link.filelink.filetype %}
|
||||
{{ link.filelink.filetype }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% if link.filelink.filetype %}
|
||||
{% with book=link.filelink.book %}
|
||||
<a href="{{ book.local_path }}">{% include "snippets/book_titleby.html" with book=book %}</a>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% block additional_data %}{% endblock %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
|
@ -2,10 +2,12 @@
|
|||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block title %}{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}{% endblock %}
|
||||
{% block title %}
|
||||
{% include "settings/reports/report_header.html" with report=report %}
|
||||
{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}
|
||||
{% include "settings/reports/report_header.html" with report=report %}
|
||||
<a href="{% url 'settings-reports' %}" class="has-text-weight-normal help">{% trans "Back to reports" %}</a>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -15,6 +17,36 @@
|
|||
{% include 'settings/reports/report_preview.html' with report=report %}
|
||||
</div>
|
||||
|
||||
{% if report.statuses.exists %}
|
||||
<div class="block">
|
||||
<h3 class="title is-4">{% trans "Reported statuses" %}</h3>
|
||||
<ul>
|
||||
{% for status in report.statuses.select_subclasses.all %}
|
||||
<li>
|
||||
{% if status.deleted %}
|
||||
<em>{% trans "Status has been deleted" %}</em>
|
||||
{% else %}
|
||||
{% include 'snippets/status/status.html' with status=status moderation_mode=True %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if report.links.exists %}
|
||||
<div class="block">
|
||||
<h3 class="title is-4">{% trans "Reported links" %}</h3>
|
||||
<div class="card block">
|
||||
<div class="card-content content">
|
||||
<div class="table-container">
|
||||
{% include "settings/reports/report_links_table.html" with links=report.links.all %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include 'settings/users/user_info.html' with user=report.user %}
|
||||
|
||||
{% include 'settings/users/user_moderation_actions.html' with user=report.user %}
|
||||
|
@ -41,23 +73,4 @@
|
|||
<button class="button">{% trans "Comment" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<h3 class="title is-4">{% trans "Reported statuses" %}</h3>
|
||||
{% if not report.statuses.exists %}
|
||||
<em>{% trans "No statuses reported" %}</em>
|
||||
{% else %}
|
||||
<ul>
|
||||
{% for status in report.statuses.select_subclasses.all %}
|
||||
<li>
|
||||
{% if status.deleted %}
|
||||
<em>{% trans "Status has been deleted" %}</em>
|
||||
{% else %}
|
||||
{% include 'snippets/status/status.html' with status=status moderation_mode=True %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
22
bookwyrm/templates/settings/reports/report_header.html
Normal file
22
bookwyrm/templates/settings/reports/report_header.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
|
||||
{% if report.statuses.exists %}
|
||||
|
||||
{% blocktrans trimmed with report_id=report.id username=report.user|username %}
|
||||
Report #{{ report_id }}: Status posted by @{{ username }}
|
||||
{% endblocktrans %}
|
||||
|
||||
{% elif report.links.exists %}
|
||||
|
||||
{% blocktrans trimmed with report_id=report.id username=report.user|username %}
|
||||
Report #{{ report_id }}: Link added by @{{ username }}
|
||||
{% endblocktrans %}
|
||||
|
||||
{% else %}
|
||||
|
||||
{% blocktrans trimmed with report_id=report.id username=report.user|username %}
|
||||
Report #{{ report_id }}: User @{{ username }}
|
||||
{% endblocktrans %}
|
||||
|
||||
{% endif %}
|
20
bookwyrm/templates/settings/reports/report_links_table.html
Normal file
20
bookwyrm/templates/settings/reports/report_links_table.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% extends "settings/link_domains/link_table.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block additional_headers %}
|
||||
<th>{% trans "Domain" %}</th>
|
||||
<th>{% trans "Actions" %}</th>
|
||||
{% endblock %}
|
||||
|
||||
{% block additional_data %}
|
||||
<td>
|
||||
<a href="{% url 'settings-link-domain' 'pending' %}#{{ link.domain.id }}">
|
||||
{{ link.domain.domain }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<form>
|
||||
<button type="submit" class="button is-danger is-light">{% trans "Block domain" %}</button>
|
||||
</form>
|
||||
</td>
|
||||
{% endblock %}
|
|
@ -1,9 +1,13 @@
|
|||
{% extends 'components/card.html' %}
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
{% load utilities %}
|
||||
|
||||
{% block card-header %}
|
||||
<h2 class="card-header-title has-background-white-ter is-block">
|
||||
<a href="{% url 'settings-report' report.id %}">{% blocktrans with report_id=report.id username=report.user.username %}Report #{{ report_id }}: {{ username }}{% endblocktrans %}</a>
|
||||
<a href="{% url 'settings-report' report.id %}">
|
||||
{% include "settings/reports/report_header.html" with report=report %}
|
||||
</a>
|
||||
</h2>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -17,7 +21,7 @@
|
|||
|
||||
{% block card-footer %}
|
||||
<div class="card-footer-item">
|
||||
<p>{% blocktrans with username=report.reporter.display_name path=report.reporter.local_path %}Reported by <a href="{{ path }}">{{ username }}</a>{% endblocktrans %}</p>
|
||||
<p>{% blocktrans with username=report.reporter|username path=report.reporter.local_path %}Reported by <a href="{{ path }}">@{{ username }}</a>{% endblocktrans %}</p>
|
||||
</div>
|
||||
<div class="card-footer-item">
|
||||
{{ report.created_date | naturaltime }}
|
||||
|
|
|
@ -5,69 +5,71 @@
|
|||
{% trans "Permanently deleted" %}
|
||||
</div>
|
||||
{% else %}
|
||||
<h3>{% trans "Actions" %}</h3>
|
||||
<h3>{% trans "User Actions" %}</h3>
|
||||
|
||||
<div class="is-flex">
|
||||
{% if user.is_active %}
|
||||
<p class="mr-1">
|
||||
<a class="button" href="{% url 'direct-messages-user' user.username %}">{% trans "Send direct message" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="box">
|
||||
<div class="is-flex">
|
||||
{% if user.is_active %}
|
||||
<p class="mr-1">
|
||||
<a class="button" href="{% url 'direct-messages-user' user.username %}">{% trans "Send direct message" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if user.is_active or user.deactivation_reason == "pending" %}
|
||||
<form name="suspend" method="post" action="{% url 'settings-report-suspend' user.id %}" class="mr-1">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="button is-danger is-light">{% trans "Suspend user" %}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form name="unsuspend" method="post" action="{% url 'settings-report-unsuspend' user.id %}" class="mr-1">
|
||||
{% csrf_token %}
|
||||
<button class="button">{% trans "Un-suspend user" %}</button>
|
||||
</form>
|
||||
{% if user.is_active or user.deactivation_reason == "pending" %}
|
||||
<form name="suspend" method="post" action="{% url 'settings-report-suspend' user.id %}" class="mr-1">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="button is-danger is-light">{% trans "Suspend user" %}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form name="unsuspend" method="post" action="{% url 'settings-report-unsuspend' user.id %}" class="mr-1">
|
||||
{% csrf_token %}
|
||||
<button class="button">{% trans "Un-suspend user" %}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
{% trans "Permanently delete user" as button_text %}
|
||||
{% include "snippets/toggle/open_button.html" with controls_text="delete_user" text=button_text class="is-danger is-light" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
{% include "settings/users/delete_user_form.html" with controls_text="delete_user" class="mt-2 mb-2" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
{% trans "Permanently delete user" as button_text %}
|
||||
{% include "snippets/toggle/open_button.html" with controls_text="delete_user" text=button_text class="is-danger is-light" %}
|
||||
<form name="permission" method="post" action="{% url 'settings-user' user.id %}">
|
||||
{% csrf_token %}
|
||||
<label class="label" for="id_user_group">{% trans "Access level:" %}</label>
|
||||
{% if group_form.non_field_errors %}
|
||||
{{ group_form.non_field_errors }}
|
||||
{% endif %}
|
||||
{% with group=user.groups.first %}
|
||||
<div class="select">
|
||||
<select name="groups" id="id_user_group" aria-describedby="desc_user_group">
|
||||
{% for value, name in group_form.fields.groups.choices %}
|
||||
<option value="{{ value }}" {% if name == group.name %}selected{% endif %}>
|
||||
{{ name|title }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
<option value="" {% if not group %}selected{% endif %}>
|
||||
User
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{% include 'snippets/form_errors.html' with errors_list=group_form.groups.errors id="desc_user_group" %}
|
||||
{% endwith %}
|
||||
<button class="button">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
{% include "settings/users/delete_user_form.html" with controls_text="delete_user" class="mt-2 mb-2" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if user.local %}
|
||||
<div>
|
||||
<form name="permission" method="post" action="{% url 'settings-user' user.id %}">
|
||||
{% csrf_token %}
|
||||
<label class="label" for="id_user_group">{% trans "Access level:" %}</label>
|
||||
{% if group_form.non_field_errors %}
|
||||
{{ group_form.non_field_errors }}
|
||||
{% endif %}
|
||||
{% with group=user.groups.first %}
|
||||
<div class="select">
|
||||
<select name="groups" id="id_user_group" aria-describedby="desc_user_group">
|
||||
{% for value, name in group_form.fields.groups.choices %}
|
||||
<option value="{{ value }}" {% if name == group.name %}selected{% endif %}>
|
||||
{{ name|title }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
<option value="" {% if not group %}selected{% endif %}>
|
||||
User
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{% include 'snippets/form_errors.html' with errors_list=group_form.groups.errors id="desc_user_group" %}
|
||||
{% endwith %}
|
||||
<button class="button">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue