Commit 24095679 by Kevin Chugh

add back comment response flagging

parent de7c5113
......@@ -139,4 +139,8 @@ if Backbone?
if textStatus == 'success'
temp_array = _.clone(@model.get('abuse_flaggers'));
temp_array.pop(window.user.id)
# if you're an admin, clear this
if DiscussionUtil.isStaff(@model.get("user_id"))
temp_array = []
@model.set('abuse_flaggers', temp_array)
......@@ -98,7 +98,7 @@ if Backbone?
renderFlagged: =>
if window.user.id in @model.get("abuse_flaggers") or or (DiscussionUtil.isStaff(@model.get("user_id")) and @model.get("abuse_flaggers").length > 0)
if window.user.id in @model.get("abuse_flaggers") or (DiscussionUtil.isStaff(@model.get("user_id")) and @model.get("abuse_flaggers").length > 0)
@$("[data-role=thread-flag]").addClass("flagged")
@$("[data-role=thread-flag]").removeClass("notflagged")
@$(".discussion-flag-abuse .flag-label").html("Misuse Reported")
......
......@@ -309,8 +309,9 @@ def flag_abuse_for_comment(request, course_id, comment_id):
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)
comment = cc.Comment.find(comment_id)
comment.unFlagAbuse(user,comment)
comment.unFlagAbuse(user,comment, removeAll)
return JsonResponse(utils.safe_content(comment.to_dict()))
@require_POST
......
......@@ -53,7 +53,7 @@ class Comment(models.Model):
request = perform_request('put', url, params)
voteable.update_attributes(request)
def unFlagAbuse(self, user, voteable):
def unFlagAbuse(self, user, voteable, removeAll):
if voteable.type == 'thread':
url = _url_for_unflag_abuse_thread(voteable.id)
elif voteable.type == 'comment':
......@@ -61,6 +61,10 @@ class Comment(models.Model):
else:
raise CommentClientError("Can flag/unflag for threads or comments")
params = {'user_id': user.id}
if removeAll:
params['all'] = True
request = perform_request('put', url, params)
voteable.update_attributes(request)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment