diff --git a/common/static/coffee/src/discussion/content.coffee b/common/static/coffee/src/discussion/content.coffee index b74779f6c7..f5c2943ac0 100644 --- a/common/static/coffee/src/discussion/content.coffee +++ b/common/static/coffee/src/discussion/content.coffee @@ -144,7 +144,13 @@ if Backbone? else @get("body") - display_tigetCommentsCount: -> + display_title: -> + if @has("highlighted_title") + String(@get("highlighted_title")).replace(//g, '').replace(/<\/highlight>/g, '') + else + @get("title") + + comment_count: -> count = 0 @get('comments').each (comment) -> count += comment.getCommentsCount() + 1 diff --git a/lms/djangoapps/django_comment_client/base/views.py b/lms/djangoapps/django_comment_client/base/views.py index 86c7a9d2e6..84a543868e 100644 --- a/lms/djangoapps/django_comment_client/base/views.py +++ b/lms/djangoapps/django_comment_client/base/views.py @@ -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) diff --git a/lms/djangoapps/django_comment_client/permissions.py b/lms/djangoapps/django_comment_client/permissions.py index 3c916eaeb3..1055add8c0 100644 --- a/lms/djangoapps/django_comment_client/permissions.py +++ b/lms/djangoapps/django_comment_client/permissions.py @@ -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'], diff --git a/lms/lib/comment_client/thread.py b/lms/lib/comment_client/thread.py index 39e8a4387b..8ecb0368be 100644 --- a/lms/lib/comment_client/thread.py +++ b/lms/lib/comment_client/thread.py @@ -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: