Merge remote-tracking branch 'tilly-q/OPW-Moderation-Update' into merge-tillyq-moderation
This commit is contained in:
commit
d1608b0157
@ -653,24 +653,28 @@ def create_moderation_tables(db):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Give each user the appopriate privileges depending whether they are an
|
# Give each user the appopriate privileges depending whether they are an
|
||||||
# admin, an active user or an inactivated user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# admin, an active user or an inactive user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
for admin_user in admin_users_ids:
|
for admin_user in admin_users_ids:
|
||||||
admin_user_id = admin_user['id']
|
admin_user_id = admin_user['id']
|
||||||
for privilege_id in [admin_privilege_id, uploader_privilege_id, reporter_privilege_id, commenter_privilege_id, active_privilege_id]:
|
for privilege_id in [admin_privilege_id, uploader_privilege_id,
|
||||||
|
reporter_privilege_id, commenter_privilege_id,
|
||||||
|
active_privilege_id]:
|
||||||
db.execute(user_privilege_assoc.insert().values(
|
db.execute(user_privilege_assoc.insert().values(
|
||||||
core__privilege_id=admin_user_id,
|
core__privilege_id=admin_user_id,
|
||||||
core__user_id=privilege_id))
|
core__user_id=privilege_id))
|
||||||
|
|
||||||
for active_user in active_users_ids:
|
for active_user in active_users_ids:
|
||||||
active_user_id = active_user['id']
|
active_user_id = active_user['id']
|
||||||
for privilege_id in [uploader_privilege_id, reporter_privilege_id, commenter_privilege_id, active_privilege_id]:
|
for privilege_id in [uploader_privilege_id, reporter_privilege_id,
|
||||||
|
commenter_privilege_id, active_privilege_id]:
|
||||||
db.execute(user_privilege_assoc.insert().values(
|
db.execute(user_privilege_assoc.insert().values(
|
||||||
core__privilege_id=active_user_id,
|
core__privilege_id=active_user_id,
|
||||||
core__user_id=privilege_id))
|
core__user_id=privilege_id))
|
||||||
|
|
||||||
for inactive_user in inactive_users_ids:
|
for inactive_user in inactive_users_ids:
|
||||||
inactive_user_id = inactive_user['id']
|
inactive_user_id = inactive_user['id']
|
||||||
for privilege_id in [uploader_privilege_id, reporter_privilege_id, commenter_privilege_id]:
|
for privilege_id in [uploader_privilege_id, reporter_privilege_id,
|
||||||
|
commenter_privilege_id]:
|
||||||
db.execute(user_privilege_assoc.insert().values(
|
db.execute(user_privilege_assoc.insert().values(
|
||||||
core__privilege_id=inactive_user_id,
|
core__privilege_id=inactive_user_id,
|
||||||
core__user_id=privilege_id))
|
core__user_id=privilege_id))
|
||||||
@ -706,7 +710,7 @@ def create_moderation_tables(db):
|
|||||||
db.commit()
|
db.commit()
|
||||||
new_user_table.rename("core__users")
|
new_user_table.rename("core__users")
|
||||||
else:
|
else:
|
||||||
# If the db is not SQLite, this process is much simpler ~~~~~~~~~~~~~~~
|
# If the db is not run using SQLite, this process is much simpler ~~~~~
|
||||||
|
|
||||||
status = user_table.columns['status']
|
status = user_table.columns['status']
|
||||||
email_verified = user_table.columns['email_verified']
|
email_verified = user_table.columns['email_verified']
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<h1>{% trans %}You have been banned{% endtrans %}
|
<h1>{% trans %}You have been banned{% endtrans %}
|
||||||
{% if expiration_date %}
|
{% if expiration_date %}
|
||||||
{% trans %}until{% endtrans %} {{ expiration_date }}
|
{% trans until_when=expiration_date %}until {{ until_when }}{% endtrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans %}indefinitely{% endtrans %}
|
{% trans %}indefinitely{% endtrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -62,7 +62,9 @@
|
|||||||
{% block mediagoblin_header_title %}{% endblock %}
|
{% block mediagoblin_header_title %}{% endblock %}
|
||||||
<div class="header_right">
|
<div class="header_right">
|
||||||
{%- if request.user %}
|
{%- if request.user %}
|
||||||
{% if request.user and request.user.has_privilege('active') and not request.user.is_banned() %}
|
{% if request.user and
|
||||||
|
request.user.has_privilege('active') and
|
||||||
|
not request.user.is_banned() %}
|
||||||
|
|
||||||
{% set notification_count = get_notification_count(request.user.id) %}
|
{% set notification_count = get_notification_count(request.user.id) %}
|
||||||
{% if notification_count %}
|
{% if notification_count %}
|
||||||
|
@ -18,12 +18,13 @@
|
|||||||
{%- extends "mediagoblin/base.html" %}
|
{%- extends "mediagoblin/base.html" %}
|
||||||
{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
|
{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
|
||||||
{%- block mediagoblin_head %}
|
{%- block mediagoblin_head %}
|
||||||
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
|
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{%- block mediagoblin_content %}
|
{%- block mediagoblin_content %}
|
||||||
{% if not report %}
|
{% if not report %}
|
||||||
Sorry, no such report found.
|
{% trans %}Sorry, no such report found.{% endtrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ request.urlgen('mediagoblin.moderation.reports') }}"
|
<a href="{{ request.urlgen('mediagoblin.moderation.reports') }}"
|
||||||
class="return_to_panel button_action"
|
class="return_to_panel button_action"
|
||||||
@ -123,12 +124,14 @@
|
|||||||
{{ report.report_content }}
|
{{ report.report_content }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if not report.is_archived_report() and not (report.reported_user.has_privilege('admin') and not request.user.has_privilege('admin')) %}
|
{% if not report.is_archived_report() and
|
||||||
<input type=button value=Resolve id=open_resolution_form />
|
not (report.reported_user.has_privilege('admin') and
|
||||||
|
not request.user.has_privilege('admin')) %}
|
||||||
|
<input type=button value="{% trans %}Resolve{% endtrans %}" id=open_resolution_form />
|
||||||
<form action="" method="POST" id=resolution_form>
|
<form action="" method="POST" id=resolution_form>
|
||||||
{{ wtforms_util.render_divs(form) }}
|
{{ wtforms_util.render_divs(form) }}
|
||||||
{{ csrf_token }}
|
{{ csrf_token }}
|
||||||
<input type=submit id="submit_this_report" value="Resolve This Report"/>
|
<input type=submit id="submit_this_report" value="{% trans %}Resolve This Report{% endtrans %}"/>
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@ -147,8 +150,12 @@
|
|||||||
<p>{{ report.result }}</p>
|
<p>{{ report.result }}</p>
|
||||||
</pre>
|
</pre>
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type=button disabled=disabled value="Resolve This Report"/>
|
<input type=button disabled=disabled value="{% trans %}Resolve This Report{% endtrans %}"/>
|
||||||
<p>You cannot take action against an administrator</p>
|
<p>
|
||||||
|
{% trans %}
|
||||||
|
You cannot take action against an administrator
|
||||||
|
{% endtrans %}
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -84,7 +84,8 @@ curr_page !=p %}
|
|||||||
{% if report.discriminator == "comment_report" %}
|
{% if report.discriminator == "comment_report" %}
|
||||||
<td>
|
<td>
|
||||||
<img
|
<img
|
||||||
src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
|
src="{{ request.staticdirect(
|
||||||
|
'/images/icon_clipboard_alert.png') }}"
|
||||||
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
|
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
|
||||||
Distributed by the GNOME project http://www.gnome.org" />
|
Distributed by the GNOME project http://www.gnome.org" />
|
||||||
<a href="{{ request.urlgen(
|
<a href="{{ request.urlgen(
|
||||||
@ -98,7 +99,8 @@ curr_page !=p %}
|
|||||||
{% elif report.discriminator == "media_report" %}
|
{% elif report.discriminator == "media_report" %}
|
||||||
<td>
|
<td>
|
||||||
<img
|
<img
|
||||||
src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
|
src="{{ request.staticdirect(
|
||||||
|
'/images/icon_clipboard_alert.png') }}"
|
||||||
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
|
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
|
||||||
Distributed by the GNOME project http://www.gnome.org" />
|
Distributed by the GNOME project http://www.gnome.org" />
|
||||||
<a href="{{ request.urlgen(
|
<a href="{{ request.urlgen(
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{%- block mediagoblin_head %}
|
{%- block mediagoblin_head %}
|
||||||
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
|
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block mediagoblin_content -%}
|
{% block mediagoblin_content -%}
|
||||||
@ -58,9 +59,11 @@
|
|||||||
<h1>
|
<h1>
|
||||||
{%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
|
{%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
|
||||||
{% if user_banned and user_banned.expiration_date %}
|
{% if user_banned and user_banned.expiration_date %}
|
||||||
— BANNED until {{ user_banned.expiration_date }}
|
— {% trans expiration_date=user_banned.expiration_date %}
|
||||||
|
BANNED until {{ expiration_date }}
|
||||||
|
{% endtrans %}
|
||||||
{% elif user_banned %}
|
{% elif user_banned %}
|
||||||
— Banned Indefinitely
|
— {% trans %}Banned Indefinitely{% endtrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
{% if not user.url and not user.bio %}
|
{% if not user.url and not user.bio %}
|
||||||
@ -90,7 +93,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user %}
|
{% if user %}
|
||||||
<h2>{%- trans %}Active Reports on {% endtrans -%}{{ user.username }}</h2>
|
<h2>
|
||||||
|
{%- trans username=user.username %}
|
||||||
|
Active Reports on {{ username }}
|
||||||
|
{% endtrans -%}
|
||||||
|
</h2>
|
||||||
{% if reports.count() %}
|
{% if reports.count() %}
|
||||||
<table class="admin_side_panel">
|
<table class="admin_side_panel">
|
||||||
<tr>
|
<tr>
|
||||||
@ -104,7 +111,9 @@
|
|||||||
<img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
|
<img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
|
||||||
<a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
|
<a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
|
||||||
report_id=report.id) }}">
|
report_id=report.id) }}">
|
||||||
{%- trans %}Report #{% endtrans -%}{{ report.id }}
|
{%- trans report_number=report.id %}
|
||||||
|
Report #{{ report_number }}
|
||||||
|
{% endtrans -%}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -122,7 +131,9 @@
|
|||||||
<tr><td></td><td></td>
|
<tr><td></td><td></td>
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
{%- trans %}No active reports filed on {% endtrans -%} {{ user.username }}
|
{%- trans
|
||||||
|
username=user.username %}No active reports filed on {{ username }}
|
||||||
|
{% endtrans -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="right_align">
|
<span class="right_align">
|
||||||
<a href="{{ request.urlgen(
|
<a href="{{ request.urlgen(
|
||||||
@ -133,7 +144,8 @@
|
|||||||
<a href="{{ request.urlgen(
|
<a href="{{ request.urlgen(
|
||||||
'mediagoblin.moderation.reports') }}?reporter={{user.id}}">
|
'mediagoblin.moderation.reports') }}?reporter={{user.id}}">
|
||||||
{%- trans
|
{%- trans
|
||||||
username=user.username %}All reports that {{ username }} has filed{% endtrans %}</a>
|
username=user.username %}All reports that {{ username }} has filed
|
||||||
|
{% endtrans %}</a>
|
||||||
</span>
|
</span>
|
||||||
<span class=clear></span>
|
<span class=clear></span>
|
||||||
<h2>{{ user.username }}'s Privileges</h2>
|
<h2>{{ user.username }}'s Privileges</h2>
|
||||||
@ -166,9 +178,9 @@
|
|||||||
<td>{{ privilege.privilege_name }}</td>
|
<td>{{ privilege.privilege_name }}</td>
|
||||||
{% if privilege in user.all_privileges %}
|
{% if privilege in user.all_privileges %}
|
||||||
<td class="user_with_privilege">
|
<td class="user_with_privilege">
|
||||||
Yes{% else %}
|
{% trans %}Yes{% endtrans %}{% else %}
|
||||||
<td class="user_without_privilege">
|
<td class="user_without_privilege">
|
||||||
No{% endif %}
|
{% trans %}No{% endtrans %}{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% if request.user.has_privilege('admin') %}
|
{% if request.user.has_privilege('admin') %}
|
||||||
<td>
|
<td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user