]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/actions/user.py
Implemented 'report user' feature
[osqa.git] / forum / actions / user.py
index d9c6be920e9411fc592666dd08e25db1ff1dbe38..7d636be0fcce12e4a78976bc7cfca4b7dc098478 100644 (file)
@@ -193,6 +193,35 @@ class AwardAction(ActionProxy):
         '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")