comments overhaul

pull/142/head
Aevann 2023-03-24 18:30:27 +02:00
parent e1e05c799d
commit 4ecb552169
9 changed files with 47 additions and 7 deletions

View File

@ -3,3 +3,8 @@
--black: #999;
--background: 34, 34, 34;
}
.blueish {
background-color: #312e49 !important;
border-left: 10px solid #312e49 !important;
}

View File

@ -95,3 +95,8 @@ pre {
h5.post-title a:visited {
color: #7a7a7a !important;
}
.blueish {
background-color: #312e49 !important;
border-left: 10px solid #312e49 !important;
}

View File

@ -135,8 +135,7 @@ color: var(--gray-700);
background-color: var(--gray-800);
}
.post-title
{
.post-title {
color: var(--gray-300) !important;
}
@ -148,3 +147,8 @@ color: var(--gray-700);
h5.post-title a:visited {
color: #6e6e6e !important;
}
.blueish {
background-color: #312e49 !important;
border-left: 10px solid #312e49 !important;
}

View File

@ -5213,6 +5213,11 @@ span.green {
background-color: #964000 !important;
border-left: 10px solid #964000 !important;
}
.blueish {
background-color: #e5e3f9 !important;
border-left: 10px solid #e5e3f9 !important;
}
.text-admin {
color: var(--primary);
}

View File

@ -68,3 +68,8 @@ h5.post-title a:visited {
.modal-content {
border: 1px var(--gray-500) solid;
}
.blueish {
background-color: #312e49 !important;
border-left: 10px solid #312e49 !important;
}

View File

@ -233,3 +233,8 @@
h5.post-title a:visited {
color: #b0b0b0 !important;
}
.blueish {
background-color: #312e49 !important;
border-left: 10px solid #312e49 !important;
}

View File

@ -362,7 +362,7 @@ def searchmessages(v:User):
next_exists = (len(comments) > PAGE_SIZE)
comments = comments[:PAGE_SIZE]
for x in comments: x.unread = True
for x in comments: x.blueish = True
comments = [x.top_comment for x in comments]

View File

@ -1034,6 +1034,8 @@ def u_username_comments(username, v=None):
comments.reverse()
for x in comments:
x.blueish = True
if x.replies2 == None: x.replies2 = []
if x.parent_comment_id:
@ -1045,6 +1047,10 @@ def u_username_comments(username, v=None):
x.parent_comment.replies2.sort(key=lambda x: x.created_utc, reverse=True)
x = x.parent_comment
if x.author_id == u.id:
x.blueish = True
if x.id in old_ids: continue
ids.add(x.id)
@ -1073,9 +1079,11 @@ def u_username_comments(username, v=None):
@limiter.limit(DEFAULT_RATELIMIT)
@auth_desired_with_logingate
def profile_more_comments(v, cid, username):
uid = get_user(username).id
comments = g.db.query(Comment).filter(
Comment.top_comment_id == get_comment(cid).top_comment_id,
Comment.author_id == get_user(username).id,
Comment.author_id == uid,
Comment.level > 9,
).all()
@ -1083,6 +1091,8 @@ def profile_more_comments(v, cid, username):
ids = set()
for x in comments:
x.blueish = True
while x.parent_comment_id != cid and x.level > 9:
if x.id in ids: break
ids.add(x.id)
@ -1093,6 +1103,9 @@ def profile_more_comments(v, cid, username):
x = x.parent_comment
if x.author_id == uid:
x.blueish = True
ids.add(x.id)
if x not in listing and x.parent_comment_id == cid:

View File

@ -113,15 +113,13 @@
{% set isreply = False %}
{% endif %}
{% set highlight_for_profile = request.path.startswith('/@') and request.path.endswith('/comments') and u and c.author_id == u.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 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 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.blueish %}blueish{% elif 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 class="user-info">
<span class="comment-collapse-icon" data-nonce="{{g.nonce}}" data-onclick="collapse_comment('{{c.id}}')"></span>