comparison 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
comparison
equal deleted inserted replaced
347:69d0306a6fe7 348:d1b11096595b
26 The admin/moderator user %s has just deactivated the account of %s for spam. 26 The admin/moderator user %s has just deactivated the account of %s for spam.
27 """ 27 """
28 28
29 def deactivate_spammer(user): 29 def deactivate_spammer(user):
30 """This function deactivate's the user, marks them as a spammer, then 30 """This function deactivate's the user, marks them as a spammer, then
31 deletes the user's comments and forum posts. 31 deletes the user's comments and forum posts. The spammer's profile is
32 cleared so any spam links won't show up anymore.
32 """ 33 """
33 user.is_active = False 34 user.is_active = False
34 user.save() 35 user.save()
35 36
36 profile = user.get_profile() 37 profile = user.get_profile()
37 profile.status = bio.models.STA_SPAMMER 38 profile.status = bio.models.STA_SPAMMER
38 profile.status_date = datetime.datetime.now() 39 profile.status_date = datetime.datetime.now()
40 profile.location = ''
41 profile.occupation = ''
42 profile.interests = ''
43 profile.profile_text = ''
44 profile.signature = ''
39 profile.save() 45 profile.save()
40 46
41 Comment.objects.filter(user=user).delete() 47 Comment.objects.filter(user=user).delete()
42 delete_user_posts(user) 48 delete_user_posts(user)
43 49