improve /@<user>/comments

master
Aevann 2023-03-22 21:53:59 +02:00
parent 177ed092d0
commit 1971dc1b73
2 changed files with 15 additions and 2 deletions

View File

@ -1034,9 +1034,20 @@ def u_username_comments(username, v=None):
for x in comments:
if x.replies2 == None: x.replies2 = []
if x.parent_comment_id:
x.parent_comment.replies2 = [x]
if x.parent_comment.replies2 == None:
x.parent_comment.replies2 = []
x.parent_comment.replies2.append(x)
x.parent_comment.replies2.sort(key=lambda x: x.created_utc, reverse=True)
x = x.parent_comment
if x.id in ids: continue
if x.parent_comment_id in ids:
if x.parent_comment.replies2 == None:
x.parent_comment.replies2 = []
x.parent_comment.replies2.append(x)
x.parent_comment.replies2.sort(key=lambda x: x.created_utc, reverse=True)
continue
listing.append(x)
ids.update([x.id for x in listing])

View File

@ -113,13 +113,15 @@
{% set isreply = False %}
{% endif %}
{% set highlight_for_profile = request.path.startswith('/@') and request.path.endswith('/comments') and v and c.author_id == v.id %}
<div id="comment-{{c.id}}" class="anchor comment {% if wall %}mt-4{% elif standalone and level==1 %}mt-0{% endif %} {% if collapse or c.collapse_for_user(v,request.full_path) %}collapsed{% endif %}" style="{% if isreply %}padding-left:0!important{% endif %}">
{% if not isreply %}
<span class="comment-collapse-desktop" style="border-left: 2px solid {% if c.ghost %}var(--primary){% else %}#{{c.author.name_color}}{% endif %}" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>
{% endif %}
<div class="comment-body">
<div id="{% if comment_info and comment_info.id == c.id %}context{%else%}comment-{{c.id}}-only{% endif %}" class="{% if c.award_count('tilt', v) %}tilt tilt-{{c.award_count('tilt', v)}}{% endif %} {% if c.unread %}unread{% endif %} {% if c.award_count('glowie', v) %}glow{% endif %} comment-{{c.id}}-only comment-anchor {% if comment_info and comment_info.id == c.id %}context{%endif%}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}">
<div id="{% if comment_info and comment_info.id == c.id %}context{%else%}comment-{{c.id}}-only{% endif %}" class="{% if c.award_count('tilt', v) %}tilt tilt-{{c.award_count('tilt', v)}}{% endif %} {% if c.unread or highlight_for_profile %}unread{% endif %} {% if c.award_count('glowie', v) %}glow{% endif %} comment-{{c.id}}-only comment-anchor {% if comment_info and comment_info.id == c.id %}context{%endif%}{% if c.is_banned %} banned{% endif %}{% if c.deleted_utc %} deleted{% endif %}">
<div class="user-info">
<span class="comment-collapse-icon" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>