Commit ed6317f3 by Arjun Singh

getting rid of terrible hack in favor of re enabling the dispatcher to sync w/ the comment service

parent 4e3d8211
......@@ -273,7 +273,7 @@ def add_user_to_default_group(user, group):
utg.users.add(User.objects.get(username=user))
utg.save()
# @receiver(post_save, sender=User)
@receiver(post_save, sender=User)
def update_user_information(sender, instance, created, **kwargs):
try:
cc_user = cc.User.from_django_user(instance)
......
......@@ -51,7 +51,7 @@ def ajax_content_response(request, course_id, content, template_name):
'content': content,
}
html = render_to_string(template_name, context)
user_info = cc.User.from_django_user(request.user).safe_attributes()
user_info = cc.User.from_django_user(request.user).to_dict()
annotated_content_info = utils.get_annotated_content_info(course_id, content, request.user, user_info)
return JsonResponse({
'html': html,
......
......@@ -64,7 +64,7 @@ def render_discussion(request, course_id, threads, *args, **kwargs):
'user': (lambda: reverse('django_comment_client.forum.views.user_profile', args=[course_id, user_id])),
}[discussion_type]()
user_info = cc.User.from_django_user(request.user).safe_attributes()
user_info = cc.User.from_django_user(request.user).to_dict()
def infogetter(thread):
return utils.get_annotated_content_infos(course_id, thread, request.user, user_info)
......@@ -176,7 +176,7 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
thread = cc.Thread.find(thread_id).retrieve(recursive=True).to_dict()
user_info = cc.User.from_django_user(request.user).safe_attributes()
user_info = cc.User.from_django_user(request.user).to_dict()
annotated_content_info = utils.get_annotated_content_infos(course_id, thread=thread, user=request.user, user_info=user_info)
......@@ -194,7 +194,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
if request.is_ajax():
user_info = cc.User.from_django_user(request.user).safe_attributes()
user_info = cc.User.from_django_user(request.user).to_dict()
thread = cc.Thread.find(thread_id).retrieve(recursive=True)
annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, user_info=user_info)
context = {'thread': thread.to_dict(), 'course_id': course_id}
......
......@@ -33,16 +33,6 @@ class User(models.Model):
params = {'source_type': source.type, 'source_id': source.id}
response = perform_request('delete', _url_for_subscription(self.id), params)
# TODO this is a hack to compensate for the fact that synchronization isn't
# happening properly.
def safe_attributes(self):
try:
return self.to_dict()
except:
self.save()
self._retrieve()
return self.to_dict()
def vote(self, voteable, value):
if voteable.type == 'thread':
url = _url_for_vote_thread(voteable.id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment