示例#1
0
def unfollow_thread(request, course_id, thread_id):
    """
    given a course id and thread id, stop following this thread
    ajax only
    """
    user = cc.User.from_django_user(request.user)
    thread = cc.Thread.find(thread_id)
    user.unfollow(thread)
    thread_unfollowed.send(sender=None, user=request.user, post=thread)
    return JsonResponse({})
示例#2
0
def unfollow_thread(request, course_id, thread_id):  # lint-amnesty, pylint: disable=unused-argument
    """
    given a course id and thread id, stop following this thread
    ajax only
    """
    user = cc.User.from_django_user(request.user)
    thread = cc.Thread.find(thread_id)
    user.unfollow(thread)
    thread_unfollowed.send(sender=None, user=request.user, post=thread)
    return JsonResponse({})
示例#3
0
def _handle_following_field(form_value, user, cc_content):
    """follow/unfollow thread for the user"""
    if form_value:
        user.follow(cc_content)
        if cc_content.type == 'thread':
            thread_followed.send(sender=None, user=user, post=cc_content)
    else:
        user.unfollow(cc_content)
        if cc_content.type == 'thread':
            thread_unfollowed.send(sender=None, user=user, post=cc_content)