'badge_name': self.award.badge.name,
}
+
+class ReportAction(ActionProxy):
+ verb = _("suspended")
+
+ def process_data(self, **kwargs):
+ self.extra = kwargs
+ # message here?
+
+
+ def process_action(self):
+
+ all_superusers = User.objects.filter(is_superuser=True)
+
+
+ send_template_email(all_superusers, "notifications/user_reported.html", {
+ 'reported': self.extra['reported'],
+ 'user':self.user,
+ 'message': self.extra['publicmsg']
+ }
+ )
+
+ def describe(self, viewer=None):
+
+ return _("%(user)s reported %(reported) : %(msg)s") % {
+ 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
+ 'reporter': self.extra.get('reported').username,
+ 'msg': self.extra.get('publicmsg', _('N/A'))
+ }
+
class SuspendAction(ActionProxy):
verb = _("suspended")
--- /dev/null
+{% load i18n extra_tags email_tags %}
+
+{% declare %}
+
+ reporter_author = html.mark_safe(smart_str(user.username))
+ reported = html.mark_safe(smart_str(reported.username))
+
+ reported_link = html.objlink(reported, style=settings.EMAIL_ANCHOR_STYLE)
+ message = html.mark_safe(smart_str(message))
+
+{% enddeclare %}
+
+{% email %}
+ {% subject %}{% blocktrans %}{{ prefix }} User reported: {{ reported }} by {{ reporter_author }}{% endblocktrans %}{% endsubject %}
+
+ {% htmlcontent notifications/base.html %}
+ <p style="{{ p_style }}">
+ {% blocktrans %}
+ User reported: {{ reported }} by {{ reporter_author }}.<br/>
+ Reporter Message: {{message}}
+ {% endblocktrans %}
+ </p>
+
+
+ {% endhtmlcontent %}
+
+{% textcontent notifications/base_text.html %}
+{% blocktrans %}
+ User reported: {{ reported }} by {{ reporter_author }}.
+ Reporter Message: {{message}}
+{% endblocktrans %}
+
+
+{% endtextcontent %}
+
+{% endemail %}
+
</td>
</tr>
{% endif %}
+
+ <tr>
+ <td colspan="2" style="text-align:right">
+ <a href="{% url user_report user.pk %}" class="ajax-command withprompt">
+ Report user
+ </a>
+ </td>
+ </tr>
<!--
{% if votes_today_left %}
<tr>
--- /dev/null
+{% load i18n %}
+
+<table>
+ <caption><h2>{% trans "Report user" %}</h2></caption>
+ <tr>
+ <td>
+ <p><b>{% trans "Public message" %}:</b></p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <textarea rows="3" name="publicmsg" cols="35"></textarea><br />
+ <small>{% trans "This message will be visible through the user activity log." %}</small>
+ </td>
+ </tr>
+</table>
url(r'^%s(?P<id>\d+)/(?P<slug>.*)/%s$' % (_('users/'), _('edit/')), app.users.edit_user, name='edit_user'),
url(r'^%s(?P<id>\d+)/%s$' % (_('users/'), _('award/')), app.users.award_points, name='user_award_points'),
url(r'^%s(?P<id>\d+)/%s$' % (_('users/'), _('suspend/')), app.users.suspend, name='user_suspend'),
+ url(r'^%s(?P<id>\d+)/%s$' % (_('users/'), _('report/')), app.users.report_user, name='user_report'),
url(r'^%s(?P<id>\d+)/%s(?P<action>[a-z]+)/(?P<status>[a-z]+)/$' % (_('users/'), _('powers/')), app.users.user_powers, name='user_powers'),
url((core_user_urls_prefix + '/%s$') % (_('users/'), _('subscriptions/')), app.users.user_subscriptions, name='user_subscriptions'),
url(r'^%s(?P<id>\d+)/(?P<slug>.*)/%s$' % (_('users/'), _('preferences/')), app.users.user_preferences, name='user_preferences'),
from forum.utils.html import sanitize_html\r
from forum.modules import decorate, ReturnImediatelyException\r
from datetime import datetime, date\r
-from forum.actions import EditProfileAction, FavoriteAction, BonusRepAction, SuspendAction\r
+from forum.actions import EditProfileAction, FavoriteAction, BonusRepAction, SuspendAction, ReportAction\r
from forum.modules import ui\r
from forum.utils import pagination\r
from forum.views.readers import QuestionListPaginatorContext, AnswerPaginatorContext\r
\r
return decorators.RefreshPageCommand()\r
\r
+@decorate.withfn(decorators.command)\r
+def report_user(request, id):\r
+ user = get_object_or_404(User, id=id)\r
+\r
+ if not request.POST.get('publicmsg', None):\r
+ return render_to_response('users/report_user.html')\r
+\r
+ data = {\r
+ 'publicmsg': request.POST.get('publicmsg', _('N/A')),\r
+ 'reported': user\r
+ }\r
+\r
+ ReportAction(user=request.user, ip=request.META['REMOTE_ADDR']).save(data=data)\r
+\r
+\r
+ return decorators.RefreshPageCommand()\r
+\r
+\r
\r
def user_view(template, tab_name, tab_title, tab_description, private=False, tabbed=True, render_to=None, weight=500):\r
def decorator(fn):\r