Exclude removed comments from "last comment" link

The "last comment posted" link in the sidebar on a topic's comments page
was still considering removed comments, so if the last comment in a
topic was removed it would link to that one. That's not very useful for
anyone, so this excludes removed comments the same way that deleted ones
were already excluded.
This commit is contained in:
Deimos
2020-09-03 15:16:21 -06:00
parent 26b1d4dd9b
commit 624123929a
2 changed files with 3 additions and 3 deletions

View File

@@ -181,9 +181,9 @@ class CommentTree:
@property
def most_recent_comment(self) -> Optional[Comment]:
"""Return the most recent non-deleted Comment in the tree."""
"""Return the most recent Comment in the tree (excluding deleted/removed)."""
for comment in reversed(self.comments):
if not comment.is_deleted:
if not (comment.is_deleted or comment.is_removed):
return comment
return None

View File

@@ -326,7 +326,7 @@
<dt>Last comment posted</dt>
<dd>
<a href="{{ comments.most_recent_comment.permalink }}" data-js-hide-sidebar-no-preventdefault>
{{ adaptive_date_responsive(topic.last_activity_time) }}
{{ adaptive_date_responsive(comments.most_recent_comment.created_time) }}
</a>
</dd>
{% else %}