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
|
||||
# admin, an active user or an inactivated user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# admin, an active user or an inactive user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
for admin_user in admin_users_ids:
|
||||
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(
|
||||
core__privilege_id=admin_user_id,
|
||||
core__user_id=privilege_id))
|
||||
|
||||
for active_user in active_users_ids:
|
||||
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(
|
||||
core__privilege_id=active_user_id,
|
||||
core__user_id=privilege_id))
|
||||
|
||||
for inactive_user in inactive_users_ids:
|
||||
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(
|
||||
core__privilege_id=inactive_user_id,
|
||||
core__user_id=privilege_id))
|
||||
@ -706,7 +710,7 @@ def create_moderation_tables(db):
|
||||
db.commit()
|
||||
new_user_table.rename("core__users")
|
||||
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']
|
||||
email_verified = user_table.columns['email_verified']
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
<h1>{% trans %}You have been banned{% endtrans %}
|
||||
{% if expiration_date %}
|
||||
{% trans %}until{% endtrans %} {{ expiration_date }}
|
||||
{% trans until_when=expiration_date %}until {{ until_when }}{% endtrans %}
|
||||
{% else %}
|
||||
{% trans %}indefinitely{% endtrans %}
|
||||
{% endif %}
|
||||
|
@ -62,7 +62,9 @@
|
||||
{% block mediagoblin_header_title %}{% endblock %}
|
||||
<div class="header_right">
|
||||
{%- 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) %}
|
||||
{% if notification_count %}
|
||||
|
@ -18,12 +18,13 @@
|
||||
{%- extends "mediagoblin/base.html" %}
|
||||
{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
|
||||
{%- block mediagoblin_head %}
|
||||
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
|
||||
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{%- block mediagoblin_content %}
|
||||
{% if not report %}
|
||||
Sorry, no such report found.
|
||||
{% trans %}Sorry, no such report found.{% endtrans %}
|
||||
{% else %}
|
||||
<a href="{{ request.urlgen('mediagoblin.moderation.reports') }}"
|
||||
class="return_to_panel button_action"
|
||||
@ -123,12 +124,14 @@
|
||||
{{ report.report_content }}
|
||||
</div>
|
||||
</div>
|
||||
{% if not report.is_archived_report() and not (report.reported_user.has_privilege('admin') and not request.user.has_privilege('admin')) %}
|
||||
<input type=button value=Resolve id=open_resolution_form />
|
||||
{% if not report.is_archived_report() and
|
||||
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>
|
||||
{{ wtforms_util.render_divs(form) }}
|
||||
{{ 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>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
@ -147,8 +150,12 @@
|
||||
<p>{{ report.result }}</p>
|
||||
</pre>
|
||||
{% else %}
|
||||
<input type=button disabled=disabled value="Resolve This Report"/>
|
||||
<p>You cannot take action against an administrator</p>
|
||||
<input type=button disabled=disabled value="{% trans %}Resolve This Report{% endtrans %}"/>
|
||||
<p>
|
||||
{% trans %}
|
||||
You cannot take action against an administrator
|
||||
{% endtrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -84,7 +84,8 @@ curr_page !=p %}
|
||||
{% if report.discriminator == "comment_report" %}
|
||||
<td>
|
||||
<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.
|
||||
Distributed by the GNOME project http://www.gnome.org" />
|
||||
<a href="{{ request.urlgen(
|
||||
@ -98,7 +99,8 @@ curr_page !=p %}
|
||||
{% elif report.discriminator == "media_report" %}
|
||||
<td>
|
||||
<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.
|
||||
Distributed by the GNOME project http://www.gnome.org" />
|
||||
<a href="{{ request.urlgen(
|
||||
|
@ -29,7 +29,8 @@
|
||||
{% endblock %}
|
||||
|
||||
{%- block mediagoblin_head %}
|
||||
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
|
||||
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block mediagoblin_content -%}
|
||||
@ -58,9 +59,11 @@
|
||||
<h1>
|
||||
{%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
|
||||
{% 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 %}
|
||||
— Banned Indefinitely
|
||||
— {% trans %}Banned Indefinitely{% endtrans %}
|
||||
{% endif %}
|
||||
</h1>
|
||||
{% if not user.url and not user.bio %}
|
||||
@ -90,7 +93,11 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% 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() %}
|
||||
<table class="admin_side_panel">
|
||||
<tr>
|
||||
@ -104,7 +111,9 @@
|
||||
<img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
|
||||
<a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
|
||||
report_id=report.id) }}">
|
||||
{%- trans %}Report #{% endtrans -%}{{ report.id }}
|
||||
{%- trans report_number=report.id %}
|
||||
Report #{{ report_number }}
|
||||
{% endtrans -%}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
@ -122,7 +131,9 @@
|
||||
<tr><td></td><td></td>
|
||||
</table>
|
||||
{% else %}
|
||||
{%- trans %}No active reports filed on {% endtrans -%} {{ user.username }}
|
||||
{%- trans
|
||||
username=user.username %}No active reports filed on {{ username }}
|
||||
{% endtrans -%}
|
||||
{% endif %}
|
||||
<span class="right_align">
|
||||
<a href="{{ request.urlgen(
|
||||
@ -133,7 +144,8 @@
|
||||
<a href="{{ request.urlgen(
|
||||
'mediagoblin.moderation.reports') }}?reporter={{user.id}}">
|
||||
{%- 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 class=clear></span>
|
||||
<h2>{{ user.username }}'s Privileges</h2>
|
||||
@ -166,9 +178,9 @@
|
||||
<td>{{ privilege.privilege_name }}</td>
|
||||
{% if privilege in user.all_privileges %}
|
||||
<td class="user_with_privilege">
|
||||
Yes{% else %}
|
||||
{% trans %}Yes{% endtrans %}{% else %}
|
||||
<td class="user_without_privilege">
|
||||
No{% endif %}
|
||||
{% trans %}No{% endtrans %}{% endif %}
|
||||
</td>
|
||||
{% if request.user.has_privilege('admin') %}
|
||||
<td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user