Fix comments_since_last_visit on first visit

On a user's first visit to a topic, this attribute wasn't being set.
This commit is contained in:
Deimos
2019-09-04 16:27:21 -06:00
parent d85dcea101
commit 07f491a760
2 changed files with 3 additions and 1 deletions

View File

@@ -109,6 +109,8 @@ class TopicQuery(PaginatedQuery):
topic.bookmark_created_time = result.created_time
topic.last_visit_time = result.visit_time
topic.comments_since_last_visit = None
if result.num_comments is not None:
new_comments = topic.num_comments - result.num_comments
# prevent showing negative "new comments" due to deletions

View File

@@ -177,7 +177,7 @@
{% if request.user
and request.user.track_comment_visits
and not request.user.collapse_old_comments
and topic.comments_since_last_visit > 0 %}
and topic.comments_since_last_visit %}
<button class="btn btn-sm btn-light" data-js-comment-collapse-read-button>Collapse read</button>
{% endif %}