diff --git a/lms/djangoapps/django_comment_client/permissions.py b/lms/djangoapps/django_comment_client/permissions.py
index 962f7954bb..ea8d4e9f24 100644
--- a/lms/djangoapps/django_comment_client/permissions.py
+++ b/lms/djangoapps/django_comment_client/permissions.py
@@ -72,26 +72,25 @@ 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"],
- 'delete_thread' : ['delete_thread'],
- 'update_comment' : ['edit_content', ['update_comment', 'is_open', 'author']],
- 'endorse_comment' : ['endorse_comment'],
- 'openclose_thread' : ['openclose_thread'],
- 'create_sub_comment' : [['create_sub_comment', 'is_open']],
- 'delete_comment' : ['delete_comment'],
- 'vote_for_comment' : [['vote', 'is_open']],
- 'undo_vote_for_comment' : [['unvote', 'is_open']],
- 'vote_for_thread' : [['vote', 'is_open']],
- 'undo_vote_for_thread' : [['unvote', 'is_open']],
- 'follow_thread' : ['follow_thread'],
- 'follow_commentable' : ['follow_commentable'],
- 'follow_user' : ['follow_user'],
- 'unfollow_thread' : ['unfollow_thread'],
- 'unfollow_commentable' : ['unfollow_commentable'],
- 'unfollow_user' : ['unfollow_user'],
- 'create_thread' : ['create_thread'],
+ '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', 'is_author']],
+ 'endorse_comment' : ['endorse_comment'],
+ 'openclose_thread' : ['openclose_thread'],
+ 'create_sub_comment': [['create_sub_comment', 'is_open']],
+ 'delete_comment' : ['delete_comment'],
+ 'vote_for_comment' : [['vote', 'is_open']],
+ 'undo_vote_for_comment': [['unvote', 'is_open']],
+ 'vote_for_thread' : [['vote', 'is_open']],
+ 'undo_vote_for_thread': [['unvote', 'is_open']],
+ 'follow_thread' : ['follow_thread'],
+ 'follow_commentable': ['follow_commentable'],
+ 'follow_user' : ['follow_user'],
+ 'unfollow_thread' : ['unfollow_thread'],
+ 'unfollow_commentable': ['unfollow_commentable'],
+ 'unfollow_user' : ['unfollow_user'],
+ 'create_thread' : ['create_thread'],
'update_moderator_status' : ['manage_moderator'],
}
diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py
index 642855ed2c..30c9042155 100644
--- a/lms/djangoapps/django_comment_client/utils.py
+++ b/lms/djangoapps/django_comment_client/utils.py
@@ -131,6 +131,7 @@ def get_annotated_content_info(course_id, content, user, type):
'can_reply': check_permissions_by_view(user, course_id, content, "create_comment" if type == 'thread' else "create_sub_comment"),
'can_endorse': check_permissions_by_view(user, course_id, content, "endorse_comment") if type == 'comment' else False,
'can_delete': check_permissions_by_view(user, course_id, content, "delete_thread" if type == 'thread' else "delete_comment"),
+ 'can_openclose': check_permissions_by_view(user, course_id, content, "openclose_thread") if type == 'thread' else False,
}
def get_annotated_content_infos(course_id, thread, user, type='thread'):
diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee
index 1613cf3285..2c01420007 100644
--- a/lms/static/coffee/src/discussion/content.coffee
+++ b/lms/static/coffee/src/discussion/content.coffee
@@ -232,14 +232,12 @@ initializeFollowThread = (thread) ->
handleDelete = (elem) ->
if $content.hasClass("thread")
url = Discussion.urlFor('delete_thread', id)
- confirmValue = confirm("Are you sure? This will delete the thread and all comments associated with it and cannot be recovered.")
+ c = confirm "Are you sure to delete thread \"" + $content.find("a.thread-title").text() + "\"?"
else
url = Discussion.urlFor('delete_comment', id)
- confirmValue = confirm("Are you sure? This will delete the comment and all replies associated with it and cannot be recovered.")
-
- if not confirmValue
+ c = confirm "Are you sure to delete this comment? "
+ if c != true
return
-
Discussion.safeAjax
$elem: $(elem)
url: url
@@ -375,6 +373,15 @@ initializeFollowThread = (thread) ->
MathJax.Hub.Queue ["Typeset", MathJax.Hub, $contentBody.attr("id")]
id = $content.attr("_id")
+
+ discussion_id = $content.parents(".discussion").attr("_id")
+ if $content.hasClass("thread")
+ permalink = Discussion.urlFor("permanent_link_thread", discussion_id, id)
+ else
+ thread_id = $content.parents(".thread").attr("_id")
+ permalink = Discussion.urlFor("permanent_link_comment", discussion_id, thread_id, id)
+ $local(".discussion-permanent-link").attr "href", permalink
+
if not Discussion.getContentInfo id, 'editable'
$local(".admin-edit").remove()
if not Discussion.getContentInfo id, 'can_reply'
@@ -383,3 +390,5 @@ initializeFollowThread = (thread) ->
$local(".admin-endorse").remove()
if not Discussion.getContentInfo id, 'can_delete'
$local(".admin-delete").remove()
+ if not Discussion.getContentInfo id, 'can_openclose'
+ $local(".discussion-openclose").remove()
diff --git a/lms/static/coffee/src/discussion/utils.coffee b/lms/static/coffee/src/discussion/utils.coffee
index c2ee2dcd6a..280c52546a 100644
--- a/lms/static/coffee/src/discussion/utils.coffee
+++ b/lms/static/coffee/src/discussion/utils.coffee
@@ -16,7 +16,7 @@ wmdEditors = {}
.addClass(cls).html(txt)
.click -> handler(this)
- urlFor: (name, param, param1) ->
+ urlFor: (name, param, param1, param2) ->
{
follow_discussion : "/courses/#{$$course_id}/discussion/#{param}/follow"
unfollow_discussion : "/courses/#{$$course_id}/discussion/#{param}/unfollow"
@@ -44,6 +44,9 @@ wmdEditors = {}
retrieve_discussion : "/courses/#{$$course_id}/discussion/forum/#{param}/inline"
retrieve_single_thread : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}"
update_moderator_status : "/courses/#{$$course_id}/discussion/users/#{param}/update_moderator_status"
+ openclose_thread : "/courses/#{$$course_id}/discussion/threads/#{param}/close"
+ permanent_link_thread : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}"
+ permanent_link_comment : "/courses/#{$$course_id}/discussion/forum/#{param}/threads/#{param1}##{param2}"
}[name]
safeAjax: (params) ->
diff --git a/lms/templates/discussion/_recent_active_posts.html b/lms/templates/discussion/_recent_active_posts.html
index b277dad6fd..8fdf7d95e7 100644
--- a/lms/templates/discussion/_recent_active_posts.html
+++ b/lms/templates/discussion/_recent_active_posts.html
@@ -1,11 +1,13 @@
-Following
- view all ›
- Following
+ view all ›
+