##// 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 fav_threads = Post.objects.filter(
73 fav_threads = Post.objects.filter(
74 id__in=fav_threads_setting.keys()).only('url', 'id', 'thread')\
74 id__in=fav_threads_setting.keys()).only('url', 'id', 'thread')\
75 .select_related('thread')
75 .select_related('thread')
76 context[CONTEXT_FAV_THREADS] = [
76
77 (post, post.get_thread().get_replies_newer(
77 context_thread_list = []
78 fav_threads_setting[str(post.id)]).count())
78 for post in fav_threads:
79 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 {% comment %}
60 {% comment %}
61 If there are new posts in the thread, show their count.
61 If there are new posts in the thread, show their count.
62 {% endcomment %}
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 {% endfor %}
64 {% endfor %}
65 </div>
65 </div>
66 {% endif %}
66 {% endif %}
General Comments 0
You need to be logged in to leave comments. Login now