mirror of
https://gitlab.com/tildes/tildes.git
synced 2026-04-17 14:59:11 +02:00
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:
@@ -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
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user