Add reporting system

Fixes #12
This commit is contained in:
rubenwardy
2022-01-20 23:30:56 +00:00
parent a47e6e8998
commit 7f5656df08
15 changed files with 155 additions and 24 deletions

View File

@@ -234,7 +234,7 @@
<li class="list-inline-item"><a href="{{ url_for('flatpage', path='policy_and_guidance') }}">{{ _("Policy and Guidance") }}</a></li>
<li class="list-inline-item"><a href="{{ url_for('flatpage', path='help/api') }}">{{ _("API") }}</a></li>
<li class="list-inline-item"><a href="{{ url_for('flatpage', path='privacy_policy') }}">{{ _("Privacy Policy") }}</a></li>
<li class="list-inline-item"><a href="{{ url_for('flatpage', path='help/reporting') }}">{{ _("Report / DMCA") }}</a></li>
<li class="list-inline-item"><a href="{{ url_for('report.report', url=url_current(True)) }}">{{ _("Report") }}</a></li>
<li class="list-inline-item"><a href="https://monitor.rubenwardy.com/d/3ELzFy3Wz/contentdb">{{ _("Stats / Monitoring") }}</a></li>
<li class="list-inline-item"><a href="{{ url_for('users.list_all') }}">{{ _("User List") }}</a></li>
<li class="list-inline-item"><a href="https://github.com/minetest/contentdb">{{ _("Source Code") }}</a></li>

View File

@@ -36,7 +36,7 @@
{% endif %}
<a name="reply-{{ r.id }}" class="text-muted float-right"
href="{{ url_for('threads.view', id=thread.id) }}#reply-{{ r.id }}">
href="{{ r.get_url() }}">
{{ r.created_at | datetime }}
</a>
</div>
@@ -48,10 +48,17 @@
<i class="fas fa-trash"></i>
</a>
{% endif %}
{% if current_user != r.author %}
<a class="float-right btn-secondary btn-sm ml-2"
title="{{ _('Report') }}"
href="{{ url_for('report.report', url=r.get_url()) }}">
<i class="fas fa-flag mr-1"></i>
</a>
{% endif %}
{% if current_user == thread.author and thread.review and thread.replies[0] == r %}
<a class="float-right btn btn-primary btn-sm ml-2"
href="{{ thread.review.package.getURL("packages.review") }}">
href="{{ thread.review.package.getURL('packages.review') }}">
<i class="fas fa-pen"></i>
</a>
{% elif r.checkPerm(current_user, "EDIT_REPLY") %}

View File

@@ -473,13 +473,16 @@
<p class="mt-3">
{% if package.approved and current_user != package.author %}
<a class="float-right"
href="{{ url_for('threads.new', pid=package.id) }}">
{{ _("Report a problem with this listing") }}
<a href="{{ url_for('report.report', url=url_current(True)) }}">
<i class="fas fa-flag mr-1"></i>
{{ _("Report") }}
</a>
{% endif %}
{% if package.checkPerm(current_user, "EDIT_PACKAGE") or package.checkPerm(current_user, "APPROVE_NEW") %}
<a class="float-right" href="{{ package.getURL("packages.audit") }}">
{% if package.approved and current_user != package.author %}
|
{% endif %}
<a href="{{ package.getURL("packages.audit") }}">
{{ _("See audit log") }}
</a>
{% endif %}

View File

@@ -0,0 +1,32 @@
{% extends "base.html" %}
{% block title %}
{{ _("Report") }}
{% endblock %}
{% block content %}
{% from "macros/forms.html" import render_field, render_submit_field, render_checkbox_field %}
<h1>{{ _("Report") }}</h1>
<form method="POST" action="" enctype="multipart/form-data">
{{ form.hidden_tag() }}
{% if url %}
<p>
URL: <code>{{ url }}</code>
</p>
{% else %}
{{ render_field(form.url, hint=_("URL to the thing you're reporting")) }}
{% endif %}
{{ render_field(form.message, hint=_("What are you reporting? Why are you reporting it?")) }}
{{ render_submit_field(form.submit) }}
<p class="mt-5 text-muted">
{{ _("Reports will be shared with ContentDB stuff.") }}
{% if is_anon %}
{{ _("Only the admin will be able to see who made the report.") }}
{% endif %}
</p>
</form>
{% endblock %}

View File

@@ -21,7 +21,12 @@
<i class="fas fa-tasks mr-1"></i>
{{ _("To Do List") }}
</a>
{% endif %}
{% endif %}
<a class="btn btn-secondary float-right mr-3" href="{{ url_for('report.report', url=url_current(True)) }}">
<i class="fas fa-flag mr-1"></i>
{{ _("Report") }}
</a>
{% if current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.MODERATOR) and user.email %}
<a class="btn btn-secondary float-right mr-3" href="{{ url_for('admin.send_single_email', username=user.username) }}">