diff gpp/forums/views/main.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 9d3bd7304050
children 3b30286adba5
line wrap: on
line diff
--- a/gpp/forums/views/main.py	Sat Jul 02 23:35:45 2011 +0000
+++ b/gpp/forums/views/main.py	Sun Jul 03 19:35:09 2011 +0000
@@ -479,10 +479,7 @@
 
     post = get_object_or_404(Post.objects.select_related(), pk=id)
 
-    can_delete = request.user.is_superuser or \
-            request.user in post.topic.forum.moderators.all()
-
-    if not can_delete:
+    if not perms.can_moderate(post.topic.forum, request.user):
         return HttpResponseForbidden("You don't have permission to delete that post.")
 
     delete_single_post(post)