
I made was I added the method has_privilege (which takes a variable amount of unicode privilege names as an argument) to the User model. This method allowed for much cleaner checks as to whether or not a user has a privilege. Other- wise, I also made it impossible for moderators to punish admins. I created a new url path and three new pages for Users to look at filed reports and the code of conduct for the mg instance. === Made reports on admins not resolvable by moderators: --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/moderation/report.html === Created new files for the new pages: --\ mediagoblin/meta/__init__.py --\ mediagoblin/meta/routing.py --\ mediagoblin/meta/views.py --\ mediagoblin/templates/mediagoblin/meta/code_of_conduct.html --\ mediagoblin/templates/mediagoblin/meta/reports_details.html --\ mediagoblin/templates/mediagoblin/meta/reports_panel.html --\ mediagoblin/routing.py --\ mediagoblin/static/css/base.css === Replaced vestigial methods of checking a user's privilege with the more ====== effective method has_privilege(u'privilege_name'): --\ mediagoblin/db/models.py --| Added in the has_privilege method to the User class --\ mediagoblin/db/migrations.py --\ mediagoblin/db/models.py --\ mediagoblin/decorators.py --\ mediagoblin/edit/lib.py --\ mediagoblin/edit/views.py --\ mediagoblin/gmg_commands/users.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/base.html --\ mediagoblin/templates/mediagoblin/user_pages/collection.html --\ mediagoblin/templates/mediagoblin/user_pages/media.html --\ mediagoblin/templates/mediagoblin/user_pages/user.html --\ mediagoblin/templates/mediagoblin/utils/collection_gallery.html --\ mediagoblin/user_pages/views.py === Minor UI changes --\ mediagoblin/templates/mediagoblin/moderation/report_panel.html --\ mediagoblin/templates/mediagoblin/moderation/user.html === Other Bugs: --\ mediagoblin/tools/response.py --\ mediagoblin/db/migrations.py
195 lines
7.7 KiB
HTML
195 lines
7.7 KiB
HTML
{#
|
|
# GNU MediaGoblin -- federated, autonomous media hosting
|
|
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#}
|
|
{%- extends "mediagoblin/base.html" %}
|
|
{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
|
|
|
|
{%- block mediagoblin_content %}
|
|
{% if not report %}
|
|
Sorry, no such report found.
|
|
{% else %}
|
|
<a href="{{ request.urlgen('mediagoblin.moderation.reports') }}"
|
|
class="return_to_panel button_action"
|
|
title="Return to Reports Panel">
|
|
{% trans %}Return to Reports Panel{% endtrans %}</a>
|
|
<h2>{% trans %}Report{% endtrans %} #{{ report.id }}</h2>
|
|
{% if report.is_comment_report() or
|
|
(report.is_archived_report() and report.comment) %}
|
|
|
|
{% trans %}Reported comment{% endtrans %}:
|
|
{% set comment = report.comment %}
|
|
{% set reported_user = comment.get_author %}
|
|
<div id="comment-{{ comment.id }}"
|
|
class="comment_wrapper">
|
|
<div class="comment_author">
|
|
<img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
|
|
<a href="{{ request.urlgen('mediagoblin.moderation.users_detail',
|
|
user=comment.get_author.username) }}"
|
|
class="comment_authorlink">
|
|
{{- reported_user.username -}}
|
|
</a>
|
|
<a href="{{ request.urlgen(
|
|
'mediagoblin.user_pages.media_home.view_comment',
|
|
comment=comment.id,
|
|
user=comment.get_media_entry.get_uploader.username,
|
|
media=comment.get_media_entry.slug_or_id) }}#comment"
|
|
class="comment_whenlink">
|
|
<span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
|
|
{%- trans formatted_time=timesince(comment.created) -%}
|
|
{{ formatted_time }} ago
|
|
{%- endtrans -%}
|
|
</span></a>:
|
|
</div>
|
|
<div class=comment_content>
|
|
{% autoescape False %}
|
|
{{ comment.content_html }}
|
|
{% endautoescape %}
|
|
</div>
|
|
</div>
|
|
{% elif report.is_media_entry_report() or
|
|
(report.is_archived_report() and report.media_entry) %}
|
|
|
|
{% set media_entry = report.media_entry %}
|
|
<div class="media_thumbnail">
|
|
<a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
|
|
user=media_entry.get_uploader.username,
|
|
media=media_entry.slug_or_id) }}">
|
|
<img src="{{ media_entry.thumb_url}}"/></a>
|
|
<a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
|
|
user=media_entry.get_uploader.username,
|
|
media=media_entry.slug_or_id) }}" class=thumb_entry_title>
|
|
{{ media_entry.title }}</a>
|
|
</div>
|
|
<div class=clear></div>
|
|
<p>
|
|
{% trans user_name=report.reported_user.username,
|
|
user_url=request.urlgen(
|
|
'mediagoblin.moderation.users_detail',
|
|
user=report.reporter.username) %}
|
|
❖ Reported media by <a href="{{ user_url }}">{{ user_name }}</a>
|
|
{% endtrans %}
|
|
</p>
|
|
<div class=clear></div>
|
|
{% else %}
|
|
<h2>{% trans user_url=request.urlgen(
|
|
'mediagoblin.moderation.users_detail',
|
|
user=report.reporter.username),
|
|
user_name=report.reported_user.username %}
|
|
CONTENT BY
|
|
<a href="{{ user_url }}"> {{ user_name }}</a>
|
|
HAS BEEN DELETED
|
|
{% endtrans %}
|
|
</h2>
|
|
{% endif %}
|
|
Reason for report:
|
|
<div id="report-{{ report.id }}"
|
|
class="report_wrapper">
|
|
<div class="report_author">
|
|
<img 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('mediagoblin.moderation.users_detail',
|
|
user=report.reporter.username) }}"
|
|
class="report_authorlink">
|
|
{{- report.reporter.username -}}
|
|
</a>
|
|
<a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
|
|
report_id=report.id) }}"
|
|
class="report_whenlink">
|
|
<span title='{{- report.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
|
|
{%- trans formatted_time=timesince(report.created) -%}
|
|
{{ formatted_time }} ago
|
|
{%- endtrans -%}
|
|
</span>
|
|
</a>
|
|
</div>
|
|
<div class="report_content">
|
|
{{ 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 />
|
|
<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"/>
|
|
</form>
|
|
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
hidden_input_names = {
|
|
'takeaway':['take_away_privileges'],
|
|
'userban':['user_banned_until','why_user_was_banned'],
|
|
'sendmessage':['message_to_user']
|
|
}
|
|
|
|
$('form#resolution_form').hide()
|
|
$('#user_banned_until').val("YYYY-MM-DD")
|
|
$('#open_resolution_form').click(function() {
|
|
$('form#resolution_form').toggle();
|
|
$.each(hidden_input_names, function(key, list){
|
|
$.each(list, function(index, name){
|
|
$('label[for='+name+']').hide();
|
|
$('#'+name).hide();
|
|
});
|
|
});
|
|
});
|
|
$('#action_to_resolve').change(function() {
|
|
$('ul#action_to_resolve li input:checked').each(function() {
|
|
$.each(hidden_input_names[$(this).val()], function(index, name){
|
|
$('label[for='+name+']').show();
|
|
$('#'+name).show();
|
|
});
|
|
});
|
|
$('ul#action_to_resolve li input:not(:checked)').each(function() {
|
|
$.each(hidden_input_names[$(this).val()], function(index, name){
|
|
$('label[for='+name+']').hide();
|
|
$('#'+name).hide();
|
|
});
|
|
});
|
|
});
|
|
$("#user_banned_until").focus(function() {
|
|
$(this).val("");
|
|
$(this).unbind('focus');
|
|
});
|
|
$("#submit_this_report").click(function(){
|
|
if ($("#user_banned_until").val() == 'YYYY-MM-DD'){
|
|
$("#user_banned_until").val("");
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% elif not (report.reported_user.has_privilege('admin')) %}
|
|
<h2><img src="{{ request.staticdirect('/images/icon_clipboard.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" />
|
|
{% trans %}Status{% endtrans %}:
|
|
</h2>
|
|
<b>{% trans %}RESOLVED{% endtrans %}</b>
|
|
{{ report.resolved.strftime("%I:%M%p %Y-%m-%d") }}
|
|
{% autoescape False %}
|
|
<p>{{ report.result }}</p>
|
|
{% endautoescape %}
|
|
{% else %}
|
|
<input type=button disabled=disabled value="Resolve This Report"/>
|
|
<p>You cannot take action against an administrator</p>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endblock %}
|