##// END OF EJS Templates
Added link to the first unread post in the favorite thread
neko259 -
r1327:f297fac2 default
parent child Browse files
Show More
@@ -73,7 +73,16 b' def _get_fav_threads(context, settings_m'
73 73 fav_threads = Post.objects.filter(
74 74 id__in=fav_threads_setting.keys()).only('url', 'id', 'thread')\
75 75 .select_related('thread')
76 context[CONTEXT_FAV_THREADS] = [
77 (post, post.get_thread().get_replies_newer(
78 fav_threads_setting[str(post.id)]).count())
79 for post in fav_threads]
76
77 context_thread_list = []
78 for post in fav_threads:
79 new_replies = post.get_thread().get_replies_newer(fav_threads_setting[str(post.id)])
80
81 element = dict()
82 element['post'] = post
83 element['count'] = new_replies.count()
84 if element['count'] > 0:
85 element['new_post'] = new_replies.first().get_absolute_url()
86 context_thread_list.append(element)
87 context[CONTEXT_FAV_THREADS] = context_thread_list
88
@@ -60,7 +60,7 b''
60 60 {% comment %}
61 61 If there are new posts in the thread, show their count.
62 62 {% endcomment %}
63 {{ thread.0.get_link_view|safe }}{% if thread.1 %} (+{{ thread.1 }}){% endif %}{% if not forloop.last %}, {% endif %}
63 {{ thread.post.get_link_view|safe }}{% if thread.count %} (<a href="{{ thread.new_post }}">+{{ thread.count }}</a>){% endif %}{% if not forloop.last %}, {% endif %}
64 64 {% endfor %}
65 65 </div>
66 66 {% endif %}
General Comments 0
You need to be logged in to leave comments. Login now