diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index b8f767e8bd..d4f6fda3c0 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -149,12 +149,14 @@ def forum_form_discussion(request, course_id, discussion_id): def get_annotated_content_info(course_id, content, user, is_thread): - return { + permissions = { 'editable': check_permissions_by_view(user, course_id, content, "update_thread" if is_thread else "update_comment"), 'can_reply': check_permissions_by_view(user, course_id, content, "create_comment" if is_thread else "create_sub_comment"), 'can_endorse': check_permissions_by_view(user, course_id, content, "endorse_comment") if not is_thread else False, 'can_delete': check_permissions_by_view(user, course_id, content, "delete_thread" if is_thread else "delete_comment"), + 'can_openclose': check_permissions_by_view(user, course_id, content, "openclose_thread") if is_thread else False, } + return permissions def get_annotated_content_infos(course_id, thread, user, is_thread=True): infos = {} diff --git a/lms/djangoapps/django_comment_client/permissions.py b/lms/djangoapps/django_comment_client/permissions.py index eae67a8361..0645d57a05 100644 --- a/lms/djangoapps/django_comment_client/permissions.py +++ b/lms/djangoapps/django_comment_client/permissions.py @@ -67,11 +67,10 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs): VIEW_PERMISSIONS = { - 'update_thread' : ['edit_content', ['update_thread', 'is_open', 'author']], - # 'create_comment' : [["create_comment", "is_open"]], - 'create_comment' : ["create_comment"], + 'update_thread' : ['edit_content', ['update_thread', 'is_open', 'is_author']], + 'create_comment' : [["create_comment", "is_open"]], 'delete_thread' : ['delete_thread'], - 'update_comment' : ['edit_content', ['update_comment', 'is_open', 'author']], + 'update_comment' : ['edit_content', ['update_comment', 'is_open', 'is_author']], 'endorse_comment' : ['endorse_comment'], 'openclose_thread' : ['openclose_thread'], 'create_sub_comment': [['create_sub_comment', 'is_open']], diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index 878d8c1789..245511b827 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -372,3 +372,5 @@ initializeFollowThread = (thread) -> $local(".discussion-endorse-control").remove() if not Discussion.getContentInfo id, 'can_delete' $local(".discussion-delete").remove() + if not Discussion.getContentInfo id, 'can_openclose' + $local(".discussion-openclose").remove() diff --git a/lms/templates/discussion/_search_bar.html b/lms/templates/discussion/_search_bar.html index 9fa60d57a7..e93b46efb2 100644 --- a/lms/templates/discussion/_search_bar.html +++ b/lms/templates/discussion/_search_bar.html @@ -12,7 +12,7 @@ def base_url_for_search(): % if query_params.get('tags', None): % else: - + % endif diff --git a/lms/templates/discussion/_thread.html b/lms/templates/discussion/_thread.html index c22e41eaad..6ba88c1b67 100644 --- a/lms/templates/discussion/_thread.html +++ b/lms/templates/discussion/_thread.html @@ -98,7 +98,7 @@ - % if type == "thread" and request.user.is_staff: + % if type == "thread": % if content['closed']: Re-open thread % else: