Commit 62412392 authored by Deimos's avatar Deimos

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.
parent 26b1d4dd
......@@ -181,9 +181,9 @@ class CommentTree:
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
......@@ -326,7 +326,7 @@
<dt>Last comment posted</dt>
<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) }}
{% else %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment