diff --git a/common/static/coffee/src/discussion/utils.coffee b/common/static/coffee/src/discussion/utils.coffee index 8f3b5e2ced..8b90f04662 100644 --- a/common/static/coffee/src/discussion/utils.coffee +++ b/common/static/coffee/src/discussion/utils.coffee @@ -51,7 +51,6 @@ class @DiscussionUtil follow_discussion : "/courses/#{$$course_id}/discussion/#{param}/follow" unfollow_discussion : "/courses/#{$$course_id}/discussion/#{param}/unfollow" create_thread : "/courses/#{$$course_id}/discussion/#{param}/threads/create" - search_similar_threads : "/courses/#{$$course_id}/discussion/#{param}/threads/search_similar" update_thread : "/courses/#{$$course_id}/discussion/threads/#{param}/update" create_comment : "/courses/#{$$course_id}/discussion/threads/#{param}/reply" delete_thread : "/courses/#{$$course_id}/discussion/threads/#{param}/delete" diff --git a/lms/djangoapps/django_comment_client/base/urls.py b/lms/djangoapps/django_comment_client/base/urls.py index 972c2ee23e..486cf5a93f 100644 --- a/lms/djangoapps/django_comment_client/base/urls.py +++ b/lms/djangoapps/django_comment_client/base/urls.py @@ -25,8 +25,6 @@ urlpatterns = patterns('django_comment_client.base.views', # nopep8 url(r'comments/(?P[\w\-]+)/flagAbuse$', 'flag_abuse_for_comment', name='flag_abuse_for_comment'), url(r'comments/(?P[\w\-]+)/unFlagAbuse$', 'un_flag_abuse_for_comment', name='un_flag_abuse_for_comment'), url(r'^(?P[\w\-.]+)/threads/create$', 'create_thread', name='create_thread'), - # TODO should we search within the board? - url(r'^(?P[\w\-.]+)/threads/search_similar$', 'search_similar_threads', name='search_similar_threads'), url(r'^(?P[\w\-.]+)/follow$', 'follow_commentable', name='follow_commentable'), url(r'^(?P[\w\-.]+)/unfollow$', 'unfollow_commentable', name='unfollow_commentable'), ) diff --git a/lms/djangoapps/django_comment_client/base/views.py b/lms/djangoapps/django_comment_client/base/views.py index c479e6f65a..cca662ab9e 100644 --- a/lms/djangoapps/django_comment_client/base/views.py +++ b/lms/djangoapps/django_comment_client/base/views.py @@ -521,27 +521,6 @@ def unfollow_user(request, course_id, followed_user_id): return JsonResponse({}) -@require_GET -def search_similar_threads(request, course_id, commentable_id): - """ - given a course id and commentable id, run query given in text get param - of request - """ - text = request.GET.get('text', None) - if text: - query_params = { - 'text': text, - 'commentable_id': commentable_id, - } - threads = cc.search_similar_threads(course_id, recursive=False, query_params=query_params) - else: - theads = [] - context = {'threads': map(utils.extend_content, threads)} - return JsonResponse({ - 'html': render_to_string('discussion/_similar_posts.html', context) - }) - - @require_POST @login_required @csrf.csrf_exempt diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index a8668b957d..407d0715a9 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -196,12 +196,6 @@ def forum_form_discussion(request, course_id): 'page': query_params['page'], }) else: - #recent_active_threads = cc.search_recent_active_threads( - # course_id, - # recursive=False, - # query_params={'follower_id': request.user.id}, - #) - with newrelic.agent.FunctionTrace(nr_transaction, "get_cohort_info"): cohorts = get_course_cohorts(course_id) cohorted_commentables = get_cohorted_commentables(course_id) @@ -283,12 +277,6 @@ def single_thread(request, course_id, discussion_id, thread_id): threads = [utils.safe_content(thread) for thread in threads] - #recent_active_threads = cc.search_recent_active_threads( - # course_id, - # recursive=False, - # query_params={'follower_id': request.user.id}, - #) - with newrelic.agent.FunctionTrace(nr_transaction, "get_metadata_for_threads"): annotated_content_info = utils.get_metadata_for_threads(course_id, threads, request.user, user_info) diff --git a/lms/lib/comment_client/comment_client.py b/lms/lib/comment_client/comment_client.py index d6a14deeff..f747d7e294 100644 --- a/lms/lib/comment_client/comment_client.py +++ b/lms/lib/comment_client/comment_client.py @@ -4,27 +4,3 @@ from .comment import Comment from .thread import Thread from .user import User from .commentable import Commentable - -from .utils import perform_request - -import settings - - -def search_similar_threads(course_id, recursive=False, query_params={}, *args, **kwargs): - default_params = {'course_id': course_id, 'recursive': recursive} - attributes = dict(default_params.items() + query_params.items()) - return perform_request('get', _url_for_search_similar_threads(), attributes, *args, **kwargs) - - -def search_recent_active_threads(course_id, recursive=False, query_params={}, *args, **kwargs): - default_params = {'course_id': course_id, 'recursive': recursive} - attributes = dict(default_params.items() + query_params.items()) - return perform_request('get', _url_for_search_recent_active_threads(), attributes, *args, **kwargs) - - -def _url_for_search_similar_threads(): - return "{prefix}/search/threads/more_like_this".format(prefix=settings.PREFIX) - - -def _url_for_search_recent_active_threads(): - return "{prefix}/search/threads/recent_active".format(prefix=settings.PREFIX)