diff --git a/files/routes/comments.py b/files/routes/comments.py index 53c4c8f86..f1036e308 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -83,6 +83,9 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): blocked.c.user_id == Comment.author_id, isouter=True ) + + # TODO (wmill) This looks wrong to me. It adds on new properties to all comments to use voted/blocked/blocking status in rendering. + # But it needs to be repeated if you ever want to render comments anywhere else. output = [] for c in comments: diff --git a/files/routes/front.py b/files/routes/front.py index 415d998c2..07c084249 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -62,10 +62,13 @@ def notifications_main(v: User): next_exists = (len(comments) > 25) comments = comments[:25] + user_blocking = [row.target_id for row in g.db.query(UserBlock).filter_by(user_id=v.id)] + for c, n in comments: c.notif_utc = n.created_utc c.unread = not n.read n.read = True + c.is_blocking = c.author_id in user_blocking listing: list[Comment] = [c for c, _ in comments] diff --git a/files/templates/comments.html b/files/templates/comments.html index 6ceef0d21..1e2dfb5bd 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -12,141 +12,141 @@ {% set replies = c.replies(v) %} {% if not c.visibility_and_message(v)[0] %} -{% if c.show_descendants(v) %} -
+ {% if v and v.admin_level >= 2 %} +-
+
+
+ {% endif %}
+ {% if v %}
+
+ {% endif %}
+
+ -
+
+
+ {%- include 'component/comment/voting_mobile.html' -%}
+
++-
+ {%- include 'component/comment/voting_desktop.html' -%}
+ {%- include 'component/comment/actions_desktop.html' -%}
+
+
+- {% if v and v.admin_level >= 2 %} --
-
-
- {% endif %}
- {% if v %}
-
- {% endif %}
-
- -
-
-
- {%- include 'component/comment/voting_mobile.html' -%}
-
---
- {%- include 'component/comment/voting_desktop.html' -%}
- {%- include 'component/comment/actions_desktop.html' -%}
-
-
-