Mercurial > public > sg101
diff gpp/forums/views/spam.py @ 563:93f049a241ff
For bitbucket issue #4, deactivate users for spam when accepting flagged user
profiles. Also use raw_id_fields on UserProfileFlagAdmin.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 09 Feb 2012 19:38:03 -0600 |
parents | 98b373ca09f3 |
children |
line wrap: on
line diff
--- a/gpp/forums/views/spam.py Wed Feb 08 18:58:57 2012 -0600 +++ b/gpp/forums/views/spam.py Thu Feb 09 19:38:03 2012 -0600 @@ -13,12 +13,11 @@ from django.template import RequestContext from django.contrib.auth.models import User -from comments.models import Comment from forums.models import Post -from forums.tools import delete_user_posts import forums.permissions as perms import bio.models from core.functions import email_admins +from antispam.utils import deactivate_spammer SPAMMER_NAILED_SUBJECT = "Spammer Nailed: %s" @@ -26,23 +25,6 @@ The admin/moderator user %s has just deactivated the account of %s for spam. """ -def deactivate_spammer(user): - """This function deactivate's the user, marks them as a spammer, then - 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() - - profile = user.get_profile() - profile.status = bio.models.STA_SPAMMER - profile.status_date = datetime.datetime.now() - profile.reset_text_fields() - profile.save() - - Comment.objects.filter(user=user).delete() - delete_user_posts(user) - def promote_stranger(user): """This function upgrades the user from stranger status to a regular user.