# HG changeset patch # User Brian Neal # Date 1399234706 18000 # Node ID feafa1c3d356a0283978b0ec712e8f064b298cde # Parent c740e097458f99eb5ab9fa059c5cc10b0fa3635d Issue #61, delete user photos when deactivating spammers. diff -r c740e097458f -r feafa1c3d356 antispam/utils.py --- a/antispam/utils.py Sun May 04 13:45:27 2014 -0500 +++ b/antispam/utils.py Sun May 04 15:18:26 2014 -0500 @@ -11,6 +11,7 @@ from bio.models import STA_SUSPENDED, STA_SPAMMER from comments.models import Comment from forums.tools import delete_user_posts +from user_photos.s3 import delete_photos def contains_spam(s): @@ -96,6 +97,12 @@ # delete shouts user.shout_set.all().delete() + # delete any uploaded photos + photos = user.uploaded_photos.all() + if len(photos): + delete_photos(photos) + photos.delete() + logging.info("User deactivated for spam: %s", user.username)