diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 75a8d8db1c..819f65fca6 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -27,8 +27,6 @@ from .module_render import toc_for_course, get_module_for_descriptor, get_module from courseware.models import StudentModule, StudentModuleHistory from course_modes.models import CourseMode -from django_comment_client.utils import get_discussion_title - from student.models import UserTestGroup, CourseEnrollment from util.cache import cache, cache_if_anonymous from xblock.fragment import Fragment @@ -39,8 +37,6 @@ from xmodule.modulestore.search import path_to_location from xmodule.course_module import CourseDescriptor import shoppingcart -import comment_client - log = logging.getLogger("mitx.courseware") template_imports = {'urllib': urllib} @@ -674,29 +670,6 @@ def mktg_course_about(request, course_id): }) -def render_notifications(request, course, notifications): - context = { - 'notifications': notifications, - 'get_discussion_title': partial(get_discussion_title, request=request, course=course), - 'course': course, - } - return render_to_string('courseware/notifications.html', context) - - -@login_required -def news(request, course_id): - course = get_course_with_access(request.user, course_id, 'load') - - notifications = comment_client.get_notifications(request.user.id) - - context = { - 'course': course, - 'content': render_notifications(request, course, notifications), - } - - return render_to_response('courseware/news.html', context) - - @login_required @cache_control(no_cache=True, no_store=True, must_revalidate=True) def progress(request, course_id, student_id=None): diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index d449f288a4..3e0699f2ef 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -20,8 +20,6 @@ from django.utils.timezone import UTC log = logging.getLogger(__name__) -# TODO these should be cached via django's caching rather than in-memory globals -_FULLMODULES = None _DISCUSSIONINFO = defaultdict(dict) @@ -62,13 +60,6 @@ def has_forum_access(uname, course_id, rolename): return role.users.filter(username=uname).exists() -def get_full_modules(): - global _FULLMODULES - if not _FULLMODULES: - _FULLMODULES = modulestore().modules - return _FULLMODULES - - def get_discussion_id_map(course): """ return a dict of the form {category: modules} @@ -77,12 +68,6 @@ def get_discussion_id_map(course): return _DISCUSSIONINFO[course.id]['id_map'] -def get_discussion_title(course, discussion_id): - initialize_discussion_info(course) - title = _DISCUSSIONINFO[course.id]['id_map'].get(discussion_id, {}).get('title', '(no title)') - return title - - def get_discussion_category_map(course): initialize_discussion_info(course) return filter_unstarted_categories(_DISCUSSIONINFO[course.id]['category_map']) diff --git a/lms/templates/courseware/notifications.html b/lms/templates/courseware/notifications.html deleted file mode 100644 index 39eaaa14b9..0000000000 --- a/lms/templates/courseware/notifications.html +++ /dev/null @@ -1,93 +0,0 @@ -<%! from django.utils.translation import ugettext as _ %> -<%! from django.core.urlresolvers import reverse %> - -<% -def url_for_thread(discussion_id, thread_id): - return reverse('django_comment_client.forum.views.single_thread', args=[course.id, discussion_id, thread_id]) -%> - -<% -def url_for_comment(discussion_id, thread_id, comment_id): - return url_for_thread(discussion_id, thread_id) + "#" + comment_id -%> - -<% -def url_for_discussion(discussion_id): - return reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id, discussion_id]) -%> - -<% -def discussion_title(discussion_id): - return get_discussion_title(discussion_id=discussion_id) -%> - -<% -def url_for_user(user_id): #TODO - return "javascript:void(0)" -%> - - -
- % for notification in notifications: - ${render_notification(notification)} - % endfor -
- -<%def name="render_user_link(notification)"> - <% info = notification['info'] %> - % if notification.get('actor_id', None): - ${info['actor_username']} - % else: - ${_("Anonymous")} - % endif - - -<%def name="render_thread_link(notification)"> - <% info = notification['info'] %> - ${info['thread_title']} - - -<%def name="render_comment_link(notification)"> - <% info = notification['info'] %> - ${_("comment")} - - -<%def name="render_discussion_link(notification)"> - <% info = notification['info'] %> - ${discussion_title(info['commentable_id'])} - - -<%def name="render_notification(notification)"> -
- % if notification['notification_type'] == 'post_reply': - ${_("{user} posted a {comment} to the thread {thread} in discussion {discussion}").format( - user=render_user_link(notification), - comment=render_comment_link(notification), - thread=render_thread_link(notification), - discussion=render_discussion_link(notification), - )} - % elif notification['notification_type'] == 'post_topic': - ${_("{user} posted a new thread {thread} in discussion {discussion}").format( - user=render_user_link(notification), - thread=render_thread_link(notification), - discussion=render_discussion_link(notification), - )} - % elif notification['notification_type'] == 'at_user': - % if notification['info']['content_type'] == 'thread': - ${_("{user} mentioned you in the thread {thread} in disucssion {discussion}").format( - user=render_user(info), - thread=render_thread_link(notification), - discussion=render_discussion_link(notification), - )} - % else: - ${_("{user} mentioned you in {comment} to the thread {thread} in discussion {discussion}").format( - user=render_user(info), - comment=render_comment_link(notification), - thread=render_thread_link(notification), - discussion=render_discussion_link(notification), - )} - % endif - % endif -
- - diff --git a/lms/urls.py b/lms/urls.py index e187cf3ff6..54223cb806 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -329,8 +329,6 @@ if settings.COURSEWARE_ENABLED: # discussion forums live within courseware, so courseware must be enabled first if settings.MITX_FEATURES.get('ENABLE_DISCUSSION_SERVICE'): urlpatterns += ( - url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/news$', - 'courseware.views.news', name="news"), url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/discussion/', include('django_comment_client.urls')), url(r'^notification_prefs/enable/', 'notification_prefs.views.ajax_enable'),