diff --git a/common/static/coffee/src/discussion/discussion.coffee b/common/static/coffee/src/discussion/discussion.coffee index 9cee068b74..2294d4a65a 100644 --- a/common/static/coffee/src/discussion/discussion.coffee +++ b/common/static/coffee/src/discussion/discussion.coffee @@ -58,10 +58,24 @@ if Backbone? @current_page = response.page sortByDate: (thread) -> - thread.get("created_at") + + if thread.get('pinned') + #use tomorrow's date + today = new Date(); + new Date(today.getTime() + (24 * 60 * 60 * 1000)); + else + thread.get("created_at") + + + sortByDateRecentFirst: (thread) -> - -(new Date(thread.get("created_at")).getTime()) + if thread.get('pinned') + #use tomorrow's date + today = new Date(); + -(new Date(today.getTime() + (24 * 60 * 60 * 1000))); + else + -(new Date(thread.get("created_at")).getTime()) #return String.fromCharCode.apply(String, # _.map(thread.get("created_at").split(""), # ((c) -> return 0xffff - c.charChodeAt())) diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index 2b05643ff5..03175a4918 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -92,6 +92,7 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG #now add the group name if the thread has a group id for thread in threads: + if thread.get('group_id'): thread['group_name'] = get_cohort_by_id(course_id, thread.get('group_id')).name thread['group_string'] = "This post visible only to Group %s." % (thread['group_name']) diff --git a/lms/templates/discussion/_single_thread.html b/lms/templates/discussion/_single_thread.html index 0dec32ad47..66e901f5e9 100644 --- a/lms/templates/discussion/_single_thread.html +++ b/lms/templates/discussion/_single_thread.html @@ -6,6 +6,9 @@
+ %if thread['pinned'] + PINNED + %endif %if thread['group_id']
This post visible only to group ${cohort_dictionary[thread['group_id']]}.
%endif diff --git a/lms/templates/discussion/_underscore_templates.html b/lms/templates/discussion/_underscore_templates.html index 8a89ffe3ed..5fdfb8aa82 100644 --- a/lms/templates/discussion/_underscore_templates.html +++ b/lms/templates/discussion/_underscore_templates.html @@ -46,7 +46,7 @@
${'<%- body %>'}
- % if has_permission(user, 'change_permission', course.id): + % if course and has_permission(user, 'openclose_thread', course.id):
Pin Thread
%else: