diff gpp/forums/views/spam.py @ 348:d1b11096595b

Fix #168; when nailing a spammer, clear their profile text fields. Guard against topics and forums that don't exist when deleting posts in the signal handler. Make the forum stats template tag only display the latest active users.
author Brian Neal <bgneal@gmail.com>
date Wed, 02 Mar 2011 02:18:28 +0000
parents 767cedc7d12a
children 9d470c7a2b93
line wrap: on
line diff
--- a/gpp/forums/views/spam.py	Wed Mar 02 01:11:32 2011 +0000
+++ b/gpp/forums/views/spam.py	Wed Mar 02 02:18:28 2011 +0000
@@ -28,7 +28,8 @@
 
 def deactivate_spammer(user):
     """This function deactivate's the user, marks them as a spammer, then
-    deletes the user's comments and forum posts.
+    deletes the user's comments and forum posts. The spammer's profile is
+    cleared so any spam links won't show up anymore.
     """
     user.is_active = False
     user.save()
@@ -36,6 +37,11 @@
     profile = user.get_profile()
     profile.status = bio.models.STA_SPAMMER
     profile.status_date = datetime.datetime.now()
+    profile.location = ''
+    profile.occupation = ''
+    profile.interests = ''
+    profile.profile_text = ''
+    profile.signature = ''
     profile.save()
 
     Comment.objects.filter(user=user).delete()