render notifications from blocked users as blocked
also cleans up indentation on comments.html for clarity
This commit is contained in:
parent
fc8834950e
commit
50ef21f729
3 changed files with 124 additions and 118 deletions
|
@ -84,6 +84,9 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
|
||||||
isouter=True
|
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 = []
|
output = []
|
||||||
for c in comments:
|
for c in comments:
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
|
|
|
@ -62,10 +62,13 @@ def notifications_main(v: User):
|
||||||
next_exists = (len(comments) > 25)
|
next_exists = (len(comments) > 25)
|
||||||
comments = 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:
|
for c, n in comments:
|
||||||
c.notif_utc = n.created_utc
|
c.notif_utc = n.created_utc
|
||||||
c.unread = not n.read
|
c.unread = not n.read
|
||||||
n.read = True
|
n.read = True
|
||||||
|
c.is_blocking = c.author_id in user_blocking
|
||||||
|
|
||||||
listing: list[Comment] = [c for c, _ in comments]
|
listing: list[Comment] = [c for c, _ in comments]
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
{% set replies = c.replies(v) %}
|
{% set replies = c.replies(v) %}
|
||||||
|
|
||||||
{% if not c.visibility_and_message(v)[0] %}
|
{% if not c.visibility_and_message(v)[0] %}
|
||||||
{% if c.show_descendants(v) %}
|
{% if c.show_descendants(v) or is_notification_page %}
|
||||||
<div id="comment-{{c.id}}" class="comment">
|
<div id="comment-{{c.id}}" class="comment">
|
||||||
<div class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}', this.parentElement)"></div>
|
<div class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}', this.parentElement)"></div>
|
||||||
<div class="comment-collapse-bar-click" onclick="collapse_comment('{{c.id}}', this.parentElement)">
|
<div class="comment-collapse-bar-click" onclick="collapse_comment('{{c.id}}', this.parentElement)">
|
||||||
<div class="comment-collapse-bar"></div>
|
<div class="comment-collapse-bar"></div>
|
||||||
|
@ -40,28 +40,28 @@
|
||||||
{% if not is_notification_page %}<button id="btn-{{c.id}}" class="d-none d-md-block btn btn-primary" onclick="morecomments('{{c.id}}')">More comments ({{c.descendant_count}})</button>{% endif %}
|
{% if not is_notification_page %}<button id="btn-{{c.id}}" class="d-none d-md-block btn btn-primary" onclick="morecomments('{{c.id}}')">More comments ({{c.descendant_count}})</button>{% endif %}
|
||||||
<a {% if not is_notification_page %}class="d-md-none" {% endif %}href="{{c.morecomments}}">More comments <i class="fas fa-long-arrow-right ml-1"></i></a>
|
<a {% if not is_notification_page %}class="d-md-none" {% endif %}href="{{c.morecomments}}">More comments <i class="fas fa-long-arrow-right ml-1"></i></a>
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
{%- set voted = c.voted_display(v) -%}
|
{%- set voted = c.voted_display(v) -%}
|
||||||
|
|
||||||
{% if standalone and level==1 %}
|
{% if standalone and level==1 %}
|
||||||
<div class="post-info post-row-cid-{{c.id}} mb-1 mr-2 mt-3">
|
<div class="post-info post-row-cid-{{c.id}} mb-1 mr-2 mt-3">
|
||||||
{% if c.post and c.post.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
{% if c.post and c.post.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||||
<span class="align-top">
|
<span class="align-top">
|
||||||
<span class="font-weight-bold">{{c.header_msg(v, is_notification_page) | safe}}</span>
|
<span class="font-weight-bold">{{c.header_msg(v, is_notification_page) | safe}}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set isreply = not standalone and c.parent_comment and c.parent_comment.sentto %}
|
{% set isreply = not standalone and c.parent_comment and c.parent_comment.sentto %}
|
||||||
|
|
||||||
<div id="comment-{{c.id}}" class="anchor comment {% if standalone and level==1 %} mt-0{% endif %} {% if c.collapse_for_user(v,request.path) %}collapsed{% endif %}">
|
<div id="comment-{{c.id}}" class="anchor comment {% if standalone and level==1 %} mt-0{% endif %} {% if c.collapse_for_user(v,request.path) %}collapsed{% endif %}">
|
||||||
{% if not isreply %}
|
{% if not isreply %}
|
||||||
<div class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}', this.parentElement)"></div>
|
<div class="comment-collapse-icon" onclick="collapse_comment('{{c.id}}', this.parentElement)"></div>
|
||||||
<div class="comment-collapse-bar-click" onclick="collapse_comment('{{c.id}}', this.parentElement)">
|
<div class="comment-collapse-bar-click" onclick="collapse_comment('{{c.id}}', this.parentElement)">
|
||||||
|
@ -141,12 +141,12 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{%- include 'component/comment/actions_mobile.html' -%}
|
{%- include 'component/comment/actions_mobile.html' -%}
|
||||||
|
|
||||||
{% if v and v.admin_level >= 2 %}
|
{% if v and v.admin_level >= 2 %}
|
||||||
{%- include 'component/comment/actions_mobile_admin.html' -%}
|
{%- include 'component/comment/actions_mobile_admin.html' -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue