This is essentially a repeat of https://github.com/mlkwaqas/edx-platform/blob/waqas/for545-user-last-thread-not-remembered/common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee#L397. Factor out a function on Discussion and call it from both places.