# along with this program. If not, see <http://www.gnu.org/licenses/>.
admin_routes = [
- ('mediagoblin.admin.panel',
- '/panel',
- 'mediagoblin.admin.views:admin_processing_panel'),
+ ('mediagoblin.admin.media_panel',
+ '/media',
+ 'mediagoblin.admin.views:admin_media_processing_panel'),
('mediagoblin.admin.users',
'/users',
'mediagoblin.admin.views:admin_users_panel'),
('mediagoblin.admin.reports',
'/reports',
- 'mediagoblin.admin.views:admin_reports_panel')]
+ 'mediagoblin.admin.views:admin_reports_panel'),
+ ('mediagoblin.admin.users_detail',
+ '/users/<string:user>',
+ 'mediagoblin.admin.views:admin_users_detail'),
+ ('mediagoblin.admin.reports_detail',
+ '/reports/<int:report_id>',
+ 'mediagoblin.admin.views:admin_reports_detail')]
from werkzeug.exceptions import Forbidden
-from mediagoblin.db.models import MediaEntry, User, MediaComment, CommentReport, ReportBase
+from mediagoblin.db.models import (MediaEntry, User, MediaComment, \
+ CommentReport, ReportBase, Privilege)
from mediagoblin.decorators import require_admin_login
from mediagoblin.tools.response import render_to_response
@require_admin_login
-def admin_processing_panel(request):
+def admin_media_processing_panel(request):
'''
Show the global media processing panel for this instance
'''
# Render to response
return render_to_response(
request,
- 'mediagoblin/admin/panel.html',
+ 'mediagoblin/admin/media_panel.html',
{'processing_entries': processing_entries,
'failed_entries': failed_entries,
'processed_entries': processed_entries})
'''
user_list = User.query
- # Render to response
return render_to_response(
request,
- 'mediagoblin/admin/user.html',
+ 'mediagoblin/admin/user_panel.html',
{'user_list': user_list})
+@require_admin_login
+def admin_users_detail(request):
+ '''
+ Shows details about a particular user.
+ '''
+ user = User.query.filter_by(username=request.matchdict['user']).first()
+ privileges = Privilege.query
+ active_reports = user.reports_filed_on.filter(
+ ReportBase.resolved==None).limit(5)
+ closed_reports = user.reports_filed_on.filter(
+ ReportBase.resolved!=None).all()
+
+ return render_to_response(
+ request,
+ 'mediagoblin/admin/user.html',
+ {'user':user,
+ 'privileges':privileges,
+ 'reports':active_reports})
+
@require_admin_login
def admin_reports_panel(request):
'''
# Render to response
return render_to_response(
request,
- 'mediagoblin/admin/report.html',
+ 'mediagoblin/admin/report_panel.html',
{'report_list':report_list,
'closed_report_list':closed_report_list})
+@require_admin_login
+def admin_reports_detail(request):
+ report = ReportBase.query.get(request.matchdict['report_id'])
+ if report.discriminator == 'comment_report':
+ comment = MediaComment.query.get(report.comment_id)
+ media_entry = None
+ elif report.discriminator == 'media_report':
+ media_entry = MediaEntry.query.get(report.media_entry_id)
+ comment = None
+
+ return render_to_response(
+ request,
+ 'mediagoblin/admin/report.html',
+ {'report':report,
+ 'media_entry':media_entry,
+ 'comment':comment})
+
+
from migrate.changeset.constraint import UniqueConstraint
from mediagoblin.db.migration_tools import RegisterMigration, inspect_table
-from mediagoblin.db.models import MediaEntry, Collection, User, MediaComment, Privilege
+from mediagoblin.db.models import (MediaEntry, Collection, User,
+ MediaComment, Privilege, ReportBase)
MIGRATIONS = {}
id = Column(Integer, primary_key=True)
reporter_id = Column(Integer, ForeignKey(User.id), nullable=False)
report_content = Column(UnicodeText)
+ reported_user_id = Column(Integer, ForeignKey(User.id), nullable=False)
created = Column(DateTime, nullable=False, default=datetime.datetime.now)
resolved = Column(DateTime)
discriminator = Column('type', Unicode(50))
Privilege_v0.__table__.create(db.bind)
PrivilegeUserAssociation_v0.__table__.create(db.bind)
db.commit()
-
-
def bio_html(self):
return cleaned_markdown_conversion(self.bio)
-
class GenerateSlugMixin(object):
"""
Mixin to add a generate_slug method to objects.
User,
backref=backref("reports_filed_by",
lazy="dynamic",
- cascade="all, delete-orphan"))
+ cascade="all, delete-orphan"),
+ primaryjoin="User.id==ReportBase.reporter_id")
report_content = Column(UnicodeText)
+ reported_user_id = Column(Integer, ForeignKey(User.id), nullable=False)
+ reported_user = relationship(
+ User,
+ backref=backref("reports_filed_on",
+ lazy="dynamic",
+ cascade="all, delete-orphan"),
+ primaryjoin="User.id==ReportBase.reported_user_id")
created = Column(DateTime, nullable=False, default=datetime.datetime.now())
resolved = Column(DateTime)
discriminator = Column('type', Unicode(50))
primary_key=True)
-privilege_foundations = [[u'admin'], [u'moderator'], [u'commenter'], [u'uploader'],[u'reporter'],[u'active']]
+privilege_foundations = [[u'admin'], [u'moderator'], [u'uploader'],[u'reporter'], [u'commenter'] ,[u'active']]
MODELS = [
User, MediaEntry, Tag, MediaTag, MediaComment, Collection, CollectionItem,
return wrapper
def user_has_privilege(privilege_name):
-#TODO handle possible errors correctly
def user_has_privilege_decorator(controller):
@wraps(controller)
def wrapper(request, *args, **kwargs):
/* comments */
-.comment_wrapper {
+.comment_wrapper, .report_wrapper {
margin-top: 20px;
margin-bottom: 20px;
}
-.comment_wrapper p {
+.comment_wrapper p, .report_wrapper p {
margin-bottom: 2px;
}
-.comment_author {
+.comment_author, .report_author {
padding-top: 4px;
font-size: 0.9em;
}
-a.comment_authorlink {
+a.comment_authorlink, a.report_authorlink {
text-decoration: none;
padding-right: 5px;
font-weight: bold;
padding-left: 2px;
}
-a.comment_authorlink:hover {
+a.comment_authorlink:hover, a.report_authorlink:hover {
text-decoration: underline;
}
-a.comment_whenlink {
+a.comment_whenlink, a.report_whenlink {
text-decoration: none;
}
-a.comment_whenlink:hover {
+a.comment_whenlink:hover, a.report_whenlink:hover {
text-decoration: underline;
}
-.comment_content {
+.comment_content, .report_content {
margin-left: 8px;
margin-top: 8px;
}
padding-right: 6px;
}
+
+a.report_authorlink, a.report_whenlink {
+ color: #D486B1;
+}
+
/* media galleries */
.media_thumbnail {
text-align: left;
}
+/* admin panels */
+
+table.admin_panel {
+ width: 100%
+}
+
+table.admin_side_panel {
+ width: 60%
+}
+
+table.admin_panel th, table.admin_side_panel th {
+ font-weight: bold;
+ padding-bottom: 4px;
+ text-align: left;
+}
/* Delete panel */
# 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" %}
+{%- extends "mediagoblin/base.html" %}
-{% block title -%}
- {% trans %}Report panel{% endtrans %} — {{ super() }}
-{%- endblock %}
-
-{% block mediagoblin_content %}
-
-<h1>{% trans %}Report panel{% endtrans %}</h1>
-
-<p>
- {% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %}
-</p>
-
-<h2>{% trans %}Reports Filed on Comments{% endtrans %}</h2>
-
-{% if report_list.count() %}
- <table class="media_panel processing">
- <tr>
- <th>ID</th>
- <th>Report Type</th>
- <th>Offender</th>
- <th>When Reported</th>
- <th>Reported By</th>
- <th>Reason</th>
- <th>Reported Comment or Media Entry</th>
- </tr>
- {% for report in report_list %}
- <tr>
- {% if report.discriminator == "comment_report" %}
- <td>{{ report.id }}</td>
- <td>Comment Report</td>
- <td>{{ report.comment.get_author.username }}</td>
- <td>{{ report.created.strftime("%F %R") }}</td>
- <td>{{ report.reporter.username }}</td>
- <td>{{ report.report_content }}</td>
- <td><a href="{{ report.comment.get_media_entry.url_for_self(request.urlgen) }}">{{ report.comment.get_media_entry.title }}</a></td>
- {% elif report.discriminator == "media_report" %}
- <td>{{ report.id }}</td>
- <td>Media Report</td>
- <td>{{ report.media_entry.get_uploader.username }}</td>
- <td>{{ report.created.strftime("%F %R") }}</td>
- <td>{{ report.reporter.username }}</td>
- <td>{{ report.report_content[0:20] }}...</td>
- <td><a href="{{ report.media_entry.url_for_self(request.urlgen) }}">{{ report.media_entry.title }}</a></td>
- {% endif %}
- </tr>
- {% endfor %}
- </table>
+{%- block mediagoblin_content %}
+{% if not report %}
+ Sorry, no such report found.
{% else %}
- <p><em>{% trans %}No open reports found.{% endtrans %}</em></p>
+ <h2> Report #{{ report.id }}</h2>
+ {% if comment %}
+ Reported 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.admin.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 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>
+ {% endif %}
+ Reason for report:
+ <div id="report-{{ report.id }}"
+ class="report_wrapper">
+ <div class="report_author">
+ <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
+ <a href="{{ request.urlgen('mediagoblin.admin.users_detail',
+ user=report.reporter.username) }}"
+ class="report_authorlink">
+ {{- report.reporter.username -}}
+ </a>
+ <a href="{{ request.urlgen('mediagoblin.admin.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>
{% endif %}
-<h2>{% trans %}Closed Reports on Comments{% endtrans %}</h2>
-{% if closed_report_list.count() %}
- <table class="media_panel processing">
- <tr>
- <th>ID</th>
- <th>Offender</th>
- <th>When Reported</th>
- <th>Reported By</th>
- <th>Reason</th>
- <th>Comment Posted On</th>
- </tr>
- {% for report in closed_report_list %}
- <tr>
- <td>{{ report.id }}</td>
- <td>{{ report.comment.get_author.username }}</td>
- <td>{{ report.created.strftime("%F %R") }}</td>
- <td>{{ report.reporter.username }}</td>
- <td>{{ report.report_content }}</td>
- <td><a href="{{ report.comment.get_media_entry.url_for_self(request.urlgen) }}">{{ report.comment.get_media_entry.title }}</a></td>
- </tr>
- {% endfor %}
- </table>
-{% else %}
- <p><em>{% trans %}No closed reports found.{% endtrans %}</em></p>
-{% endif %}
{% endblock %}
--- /dev/null
+{#
+# 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" %}
+
+{% block title -%}
+ {% trans %}Report panel{% endtrans %} — {{ super() }}
+{%- endblock %}
+
+{% block mediagoblin_content %}
+
+<h1>{% trans %}Report panel{% endtrans %}</h1>
+
+<p>
+ {% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %}
+</p>
+
+<h2>{% trans %}Reports Filed on Comments{% endtrans %}</h2>
+
+{% if report_list.count() %}
+ <table class="admin_panel processing">
+ <tr>
+ <th>ID</th>
+ <th>Report Type</th>
+ <th>Offender</th>
+ <th>When Reported</th>
+ <th>Reported By</th>
+ <th>Reason</th>
+ <th>Reported Comment or Media Entry</th>
+ </tr>
+ {% for report in report_list %}
+ <tr>
+ {% if report.discriminator == "comment_report" %}
+ <td>{{ report.id }}</td>
+ <td>Comment Report</td>
+ <td>{{ report.comment.get_author.username }}</td>
+ <td>{{ report.created.strftime("%F %R") }}</td>
+ <td>{{ report.reporter.username }}</td>
+ <td>{{ report.report_content }}</td>
+ <td><a href="{{ report.comment.get_media_entry.url_for_self(request.urlgen) }}">{{ report.comment.get_media_entry.title }}</a></td>
+ {% elif report.discriminator == "media_report" %}
+ <td>{{ report.id }}</td>
+ <td>Media Report</td>
+ <td>{{ report.media_entry.get_uploader.username }}</td>
+ <td>{{ report.created.strftime("%F %R") }}</td>
+ <td>{{ report.reporter.username }}</td>
+ <td>{{ report.report_content[0:20] }}...</td>
+ <td><a href="{{ report.media_entry.url_for_self(request.urlgen) }}">{{ report.media_entry.title }}</a></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+{% else %}
+ <p><em>{% trans %}No open reports found.{% endtrans %}</em></p>
+{% endif %}
+<h2>{% trans %}Closed Reports on Comments{% endtrans %}</h2>
+{% if closed_report_list.count() %}
+ <table class="media_panel processing">
+ <tr>
+ <th>ID</th>
+ <th>Offender</th>
+ <th>When Reported</th>
+ <th>Reported By</th>
+ <th>Reason</th>
+ <th>Comment Posted On</th>
+ </tr>
+ {% for report in closed_report_list %}
+ <tr>
+ <td>{{ report.id }}</td>
+ <td>{{ report.comment.get_author.username }}</td>
+ <td>{{ report.created.strftime("%F %R") }}</td>
+ <td>{{ report.reporter.username }}</td>
+ <td>{{ report.report_content }}</td>
+ <td><a href="{{ report.comment.get_media_entry.url_for_self(request.urlgen) }}">{{ report.comment.get_media_entry.title }}</a></td>
+ </tr>
+ {% endfor %}
+ </table>
+{% else %}
+ <p><em>{% trans %}No closed reports found.{% endtrans %}</em></p>
+{% endif %}
+{% endblock %}
#}
{% extends "mediagoblin/base.html" %}
-{% block title -%}
- {% trans %}User panel{% endtrans %} — {{ super() }}
-{%- endblock %}
-
-{% block mediagoblin_content %}
-
-<h1>{% trans %}User panel{% endtrans %}</h1>
-
-<p>
- {% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %}
-</p>
-
-<h2>{% trans %}Active Users{% endtrans %}</h2>
-
-{% if user_list.count() %}
- <table class="media_panel processing">
- <tr>
- <th>ID</th>
- <th>Username</th>
- <th>When Joined</th>
- <th># of Comments Posted</th>
- </tr>
- {% for user in user_list %}
+
+{% block title %}
+ {%- if user -%}
+ {%- trans username=user.username -%}
+ User: {{ username }}
+ {%- endtrans %} — {{ super() }}
+ {%- else -%}
+ {{ super() }}
+ {%- endif -%}
+{% endblock %}
+
+
+{% block mediagoblin_content -%}
+ {# If no user... #}
+ {% if not user %}
+ <p>{% trans %}Sorry, no such user found.{% endtrans %}</p>
+
+ {# User exists, but needs verification #}
+ {% elif user.status == "needs_email_verification" %}
+ <div class="form_box">
+ <h1>{% trans %}Email verification needed{% endtrans %}</h1>
+
+ <p>
+ {% trans -%}
+ Someone has registered an account with this username, but it still has to be activated.
+ {%- endtrans %}
+ </p>
+
+ <p>
+ {% trans login_url=request.urlgen('mediagoblin.auth.login') -%}
+ If you are that person but you've lost your verification email, you can <a href="{{ login_url }}">log in</a> and resend it.
+ {%- endtrans %}
+ </p>
+ </div>
+
+ {# Active(?) (or at least verified at some point) user, horray! #}
+ {% else %}
+ <h1>
+ {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
+ </h1>
+
+ {% if not user.url and not user.bio %}
+ <div class="profile_sidebar empty_space">
+ <p>
+ {% trans -%}
+ This user hasn't filled in their profile (yet).
+ {%- endtrans %}
+ </p>
+ {% else %}
+ <div class="profile_sidebar">
+ {% include "mediagoblin/utils/profile.html" %}
+ {% if request.user and
+ (request.user.id == user.id or request.user.is_admin) %}
+ <a href="{{ request.urlgen('mediagoblin.edit.profile',
+ user=user.username) }}">
+ {%- trans %}Edit profile{% endtrans -%}
+ </a>
+ {% endif %}
+ {% endif %}
+ <p>
+ <a href="{{ request.urlgen('mediagoblin.user_pages.collection_list',
+ user=user.username) }}">
+ {%- trans %}Browse collections{% endtrans -%}
+ </a>
+ </p>
+ </div>
+ {% endif %}
+ {% if user %}
+ <h2>{%- trans %}Active Reports on{% endtrans -%} {{ user.username }}</h2>
+ {% if reports.count() %}
+ <table class="admin_side_panel">
<tr>
- <td>{{ user.id }}</td>
- <td>{{ user.username }}</td>
- <td>{{ user.created.strftime("%F %R") }}</td>
- <td>{{ user.posted_comments.count() }}</td>
+ <th>{%- trans %}Report ID{% endtrans -%}</th>
+ <th>{%- trans %}Reported Content{% endtrans -%}</th>
+ <th>{%- trans %}Description of Report{% endtrans -%}</th>
</tr>
- {% endfor %}
- </table>
-{% else %}
- <p><em>{% trans %}No users found.{% endtrans %}</em></p>
-{% endif %}
+ {% for report in reports %}
+ <tr>
+ <td>
+ <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
+ <a href="{{ request.urlgen('mediagoblin.admin.reports_detail',
+ report_id=report.id) }}">
+ {%- trans %}Report #{% endtrans -%}{{ report.id }}
+ </a>
+ </td>
+ <td>
+ {% if report.discriminator == "comment_report" %}
+ <a>{%- trans %}Reported Comment{% endtrans -%}</a>
+ {% elif report.discriminator == "media_report" %}
+ <a>{%- trans %}Reported Media Entry{% endtrans -%}</a>
+ {% endif %}
+ </td>
+ <td>{{ report.report_content[:21] }}{% if report.report_content|count >20 %}...{% endif %}</td>
+ <td>{%- trans %}Resolve{% endtrans -%}</td>
+ </tr>
+ {% endfor %}
+ <tr><td></td><td></td>
+ </table>
+ {% else %}
+ {%- trans %}No active reports filed on{% endtrans -%} {{ user.username }}
+ {% endif %}
+ <a class="right_align">{{ user.username }}'s report history</a>
+ <span class=clear></span>
+ <h2>{{ user.username }}'s Privileges</h2>
+ <table class="admin_panel">
+ <tr>
+ <th>{% trans %}Privilege{% endtrans %}</th>
+ <th>{% trans %}User Has Privilege{% endtrans %}</th>
+ {% for privilege in privileges %}
+ <tr>
+ <td>{{ privilege.privilege_name }}</td>
+ <td>{% if privilege in user.all_privileges %}Yes{% else %}No{% endif %}</td>
+ <td>{% if privilege in user.all_privileges and privilege.id < request.user.get_highest_privilege().id %}<a>{% trans %}Take Away{% endtrans %}</a>{% else %}<a>{% trans %}Give Privilege{% endtrans %}</a>{% endif %}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ {% endif %}
{% endblock %}
--- /dev/null
+{#
+# 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" %}
+
+{% block title -%}
+ {% trans %}User panel{% endtrans %} — {{ super() }}
+{%- endblock %}
+
+{% block mediagoblin_content %}
+
+<h1>{% trans %}User panel{% endtrans %}</h1>
+
+<p>
+ {% trans %}Here you can look up users in order to take punitive actions on them.{% endtrans %}
+</p>
+
+<h2>{% trans %}Active Users{% endtrans %}</h2>
+
+{% if user_list.count() %}
+ <table class="admin_panel processing">
+ <tr>
+ <th>{% trans %}ID{% endtrans %}</th>
+ <th>{% trans %}Username{% endtrans %}</th>
+ <th>{% trans %}When Joined{% endtrans %}</th>
+ <th>{% trans %}# of Comments Posted{% endtrans %}</th>
+ </tr>
+ {% for user in user_list %}
+ <tr>
+ <td>{{ user.id }}</td>
+ <td><a href="{{ request.urlgen('mediagoblin.admin.users_detail',
+ user= user.username) }}">{{ user.username }}</a></td>
+ <td>{{ user.created.strftime("%F %R") }}</td>
+ <td>{{ user.posted_comments.count() }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+{% else %}
+ <p><em>{% trans %}No users found.{% endtrans %}</em></p>
+{% endif %}
+{% endblock %}
{% if request.user.is_admin %}
<p>
<span class="dropdown_title">Admin powers:</span>
- <a href="{{ request.urlgen('mediagoblin.admin.panel') }}">
+ <a href="{{ request.urlgen('mediagoblin.admin.media_panel') }}">
{%- trans %}Media processing panel{% endtrans -%}
</a>
</p>
{% trans %}Add a comment{% endtrans %}
</a>
{% endif %}
- <a
- {% if not request.user -%}
- href="{{ request.urlgen('mediagoblin.auth.login') }}"
- {% else %}
- href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_media',
- user=media.get_uploader.username,
- media=media.slug_or_id) }}"
- {% endif %}
- class="button_action" id="button_reportmedia" title="Report media">
- {% trans %}Report media{% endtrans %}
- </a>
{% if request.user %}
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
user= media.get_uploader.username,
{% include "mediagoblin/utils/collections.html" %}
+ {% include "mediagoblin/utils/report.html" %}
+
{% include "mediagoblin/utils/license.html" %}
{% include "mediagoblin/utils/exif.html" %}
--- /dev/null
+{#
+# 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/>.
+#}
+
+{% block report_content -%}
+ <p>
+ <a
+ {% if not request.user -%}
+ href="{{ request.urlgen('mediagoblin.auth.login') }}"
+ {% else %}
+ href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_media',
+ user=media.get_uploader.username,
+ media=media.slug_or_id) }}"
+ {% endif %}
+ class="button_action" id="button_reportmedia" title="Report media">
+ {% trans %}Report media{% endtrans %}
+ </a>
+ </p>
+{% endblock %}
from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin import mg_globals
from mediagoblin.db.base import Session
-from mediagoblin.db.models import CollectionItem, MediaReport, CommentReport
+from mediagoblin.db.models import (CollectionItem, MediaReport, CommentReport,
+ MediaComment, MediaEntry)
from mediagoblin.user_pages import forms as user_forms
if report_form.validate() and 'comment_id' in form_dict.keys():
report_model = CommentReport()
report_model.comment_id = report_form.comment_id.data
+ report_model.reported_user_id = MediaComment.query.get(
+ report_model.comment_id).get_author.id
elif report_form.validate() and 'media_entry_id' in form_dict.keys():
report_model = MediaReport()
report_model.media_entry_id = report_form.media_entry_id.data
+ report_model.reported_user_id = MediaEntry.query.get(
+ report_model.media_entry_id).get_uploader.id
else:
return None