Remove unused methods from comment_client
This commit is contained in:
@@ -51,7 +51,6 @@ class @DiscussionUtil
|
|||||||
follow_discussion : "/courses/#{$$course_id}/discussion/#{param}/follow"
|
follow_discussion : "/courses/#{$$course_id}/discussion/#{param}/follow"
|
||||||
unfollow_discussion : "/courses/#{$$course_id}/discussion/#{param}/unfollow"
|
unfollow_discussion : "/courses/#{$$course_id}/discussion/#{param}/unfollow"
|
||||||
create_thread : "/courses/#{$$course_id}/discussion/#{param}/threads/create"
|
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"
|
update_thread : "/courses/#{$$course_id}/discussion/threads/#{param}/update"
|
||||||
create_comment : "/courses/#{$$course_id}/discussion/threads/#{param}/reply"
|
create_comment : "/courses/#{$$course_id}/discussion/threads/#{param}/reply"
|
||||||
delete_thread : "/courses/#{$$course_id}/discussion/threads/#{param}/delete"
|
delete_thread : "/courses/#{$$course_id}/discussion/threads/#{param}/delete"
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ urlpatterns = patterns('django_comment_client.base.views', # nopep8
|
|||||||
url(r'comments/(?P<comment_id>[\w\-]+)/flagAbuse$', 'flag_abuse_for_comment', name='flag_abuse_for_comment'),
|
url(r'comments/(?P<comment_id>[\w\-]+)/flagAbuse$', 'flag_abuse_for_comment', name='flag_abuse_for_comment'),
|
||||||
url(r'comments/(?P<comment_id>[\w\-]+)/unFlagAbuse$', 'un_flag_abuse_for_comment', name='un_flag_abuse_for_comment'),
|
url(r'comments/(?P<comment_id>[\w\-]+)/unFlagAbuse$', 'un_flag_abuse_for_comment', name='un_flag_abuse_for_comment'),
|
||||||
url(r'^(?P<commentable_id>[\w\-.]+)/threads/create$', 'create_thread', name='create_thread'),
|
url(r'^(?P<commentable_id>[\w\-.]+)/threads/create$', 'create_thread', name='create_thread'),
|
||||||
# TODO should we search within the board?
|
|
||||||
url(r'^(?P<commentable_id>[\w\-.]+)/threads/search_similar$', 'search_similar_threads', name='search_similar_threads'),
|
|
||||||
url(r'^(?P<commentable_id>[\w\-.]+)/follow$', 'follow_commentable', name='follow_commentable'),
|
url(r'^(?P<commentable_id>[\w\-.]+)/follow$', 'follow_commentable', name='follow_commentable'),
|
||||||
url(r'^(?P<commentable_id>[\w\-.]+)/unfollow$', 'unfollow_commentable', name='unfollow_commentable'),
|
url(r'^(?P<commentable_id>[\w\-.]+)/unfollow$', 'unfollow_commentable', name='unfollow_commentable'),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -521,27 +521,6 @@ def unfollow_user(request, course_id, followed_user_id):
|
|||||||
return JsonResponse({})
|
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
|
@require_POST
|
||||||
@login_required
|
@login_required
|
||||||
@csrf.csrf_exempt
|
@csrf.csrf_exempt
|
||||||
|
|||||||
@@ -196,12 +196,6 @@ def forum_form_discussion(request, course_id):
|
|||||||
'page': query_params['page'],
|
'page': query_params['page'],
|
||||||
})
|
})
|
||||||
else:
|
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"):
|
with newrelic.agent.FunctionTrace(nr_transaction, "get_cohort_info"):
|
||||||
cohorts = get_course_cohorts(course_id)
|
cohorts = get_course_cohorts(course_id)
|
||||||
cohorted_commentables = get_cohorted_commentables(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]
|
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"):
|
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)
|
annotated_content_info = utils.get_metadata_for_threads(course_id, threads, request.user, user_info)
|
||||||
|
|
||||||
|
|||||||
@@ -4,27 +4,3 @@ from .comment import Comment
|
|||||||
from .thread import Thread
|
from .thread import Thread
|
||||||
from .user import User
|
from .user import User
|
||||||
from .commentable import Commentable
|
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)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user