diff gpp/forums/views/spam.py @ 460:2ff5f4c1476d

Fixing #221. Found some additional cases where the forum moderator check was failing. Replaced this code with calls to the new permissions module.
author Brian Neal <bgneal@gmail.com>
date Sun, 03 Jul 2011 19:35:09 +0000
parents 9d470c7a2b93
children 98b373ca09f3
line wrap: on
line diff
--- a/gpp/forums/views/spam.py	Sat Jul 02 23:35:45 2011 +0000
+++ b/gpp/forums/views/spam.py	Sun Jul 03 19:35:09 2011 +0000
@@ -17,6 +17,7 @@
 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
 
@@ -62,9 +63,7 @@
     poster = post.user
     poster_profile = poster.get_profile()
 
-    can_moderate = request.user.is_superuser or (
-            request.user in post.topic.forum.moderators.all())
-
+    can_moderate = perms.can_moderate(post.topic.forum, request.user)
     can_deactivate = (poster_profile.status == bio.models.STA_STRANGER and not
             poster.is_superuser)
 
@@ -120,9 +119,7 @@
     poster = post.user
     poster_profile = poster.get_profile()
 
-    can_moderate = request.user.is_superuser or (
-            request.user in post.topic.forum.moderators.all())
-
+    can_moderate = perms.can_moderate(post.topic.forum, request.user)
     can_promote = poster_profile.status == bio.models.STA_STRANGER
 
     if request.method == "POST" and can_moderate and can_promote: