def _load_thread_for_viewing(request, course, discussion_id, thread_id, raise_event): """ Loads the discussion thread with the specified ID and fires an edx.forum.thread.viewed event. Args: request: The Django request. course_id: The ID of the owning course. discussion_id: The ID of the owning discussion. thread_id: The ID of the thread. raise_event: Whether an edx.forum.thread.viewed tracking event should be raised Returns: The thread in question if the user can see it. Raises: Http404 if the thread does not exist or the user cannot see it. """ thread = _find_thread(request, course, discussion_id=discussion_id, thread_id=thread_id) if not thread: raise Http404 if raise_event: track_thread_viewed_event(request, course, thread) return thread
def _load_thread_for_viewing(request, course, discussion_id, thread_id, raise_event): """ Loads the discussion thread with the specified ID and fires an edx.forum.thread.viewed event. Args: request: The Django request. course_id: The ID of the owning course. discussion_id: The ID of the owning discussion. thread_id: The ID of the thread. raise_event: Whether an edx.forum.thread.viewed tracking event should be raised Returns: The thread in question if the user can see it. Raises: Http404 if the thread does not exist or the user cannot see it. """ thread = _find_thread(request, course, discussion_id=discussion_id, thread_id=thread_id) if not thread: raise Http404 if raise_event: track_thread_viewed_event(request, course, thread) return thread