fixes cleanup
This commit is contained in:
@@ -293,6 +293,9 @@ def flag_abuse_for_thread(request, course_id, thread_id):
|
||||
thread.flagAbuse(user,thread)
|
||||
return JsonResponse(utils.safe_content(thread.to_dict()))
|
||||
|
||||
@require_POST
|
||||
@login_required
|
||||
@permitted
|
||||
def un_flag_abuse_for_thread(request, course_id, thread_id):
|
||||
user = cc.User.from_django_user(request.user)
|
||||
|
||||
@@ -301,12 +304,18 @@ def un_flag_abuse_for_thread(request, course_id, thread_id):
|
||||
thread.unFlagAbuse(user,thread,removeAll)
|
||||
return JsonResponse(utils.safe_content(thread.to_dict()))
|
||||
|
||||
@require_POST
|
||||
@login_required
|
||||
@permitted
|
||||
def flag_abuse_for_comment(request, course_id, comment_id):
|
||||
user = cc.User.from_django_user(request.user)
|
||||
comment = cc.Comment.find(comment_id)
|
||||
comment.flagAbuse(user,comment)
|
||||
return JsonResponse(utils.safe_content(comment.to_dict()))
|
||||
|
||||
@require_POST
|
||||
@login_required
|
||||
@permitted
|
||||
def un_flag_abuse_for_comment(request, course_id, comment_id):
|
||||
user = cc.User.from_django_user(request.user)
|
||||
removeAll = cached_has_permission(request.user, 'openclose_thread', course_id)
|
||||
|
||||
@@ -73,8 +73,7 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs):
|
||||
return True in results
|
||||
elif operator == "and":
|
||||
return not False in results
|
||||
return True
|
||||
#return test(user, permissions, operator="or")
|
||||
return test(user, permissions, operator="or")
|
||||
|
||||
|
||||
VIEW_PERMISSIONS = {
|
||||
@@ -90,6 +89,7 @@ VIEW_PERMISSIONS = {
|
||||
'undo_vote_for_comment': [['unvote', 'is_open']],
|
||||
'vote_for_thread' : [['vote', 'is_open']],
|
||||
'flag_abuse_for_thread': [['vote', 'is_open']],
|
||||
'un_flag_abuse_for_thread': [['vote', 'is_open']],
|
||||
'undo_vote_for_thread': [['unvote', 'is_open']],
|
||||
'pin_thread': ['create_comment'],
|
||||
'un_pin_thread': ['create_comment'],
|
||||
|
||||
@@ -99,7 +99,7 @@ class Thread(models.Model):
|
||||
elif voteable.type == 'comment':
|
||||
url = _url_for_unflag_comment(voteable.id)
|
||||
else:
|
||||
raise CommentClientError("Can flag/unflag for threads or comments")
|
||||
raise CommentClientError("Can only flag/unflag for threads or comments")
|
||||
params = {'user_id': user.id}
|
||||
#if you're an admin, when you unflag, remove ALL flags
|
||||
if removeAll:
|
||||
|
||||
Reference in New Issue
Block a user