From 4ecb552169c5eab79e8e9c8acde8aae332b79322 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 24 Mar 2023 18:30:27 +0200 Subject: [PATCH] comments overhaul --- files/assets/css/classic_dark.css | 5 +++++ files/assets/css/dark.css | 5 +++++ files/assets/css/dramblr.css | 8 ++++++-- files/assets/css/main.css | 5 +++++ files/assets/css/midnight.css | 5 +++++ files/assets/css/tron.css | 5 +++++ files/routes/search.py | 2 +- files/routes/users.py | 15 ++++++++++++++- files/templates/comments.html | 4 +--- 9 files changed, 47 insertions(+), 7 deletions(-) diff --git a/files/assets/css/classic_dark.css b/files/assets/css/classic_dark.css index f37e87f21e..8a9b2d82cd 100644 --- a/files/assets/css/classic_dark.css +++ b/files/assets/css/classic_dark.css @@ -3,3 +3,8 @@ --black: #999; --background: 34, 34, 34; } + +.blueish { + background-color: #312e49 !important; + border-left: 10px solid #312e49 !important; +} diff --git a/files/assets/css/dark.css b/files/assets/css/dark.css index 0c4cb78739..6fd5d439d5 100644 --- a/files/assets/css/dark.css +++ b/files/assets/css/dark.css @@ -95,3 +95,8 @@ pre { h5.post-title a:visited { color: #7a7a7a !important; } + +.blueish { + background-color: #312e49 !important; + border-left: 10px solid #312e49 !important; +} diff --git a/files/assets/css/dramblr.css b/files/assets/css/dramblr.css index 00c281cc14..8ef5963d20 100644 --- a/files/assets/css/dramblr.css +++ b/files/assets/css/dramblr.css @@ -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; +} diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 30a903c602..493f2a4ffe 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -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); } diff --git a/files/assets/css/midnight.css b/files/assets/css/midnight.css index c69ebd9e14..d22a9bf632 100644 --- a/files/assets/css/midnight.css +++ b/files/assets/css/midnight.css @@ -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; +} diff --git a/files/assets/css/tron.css b/files/assets/css/tron.css index 2f4b5e699d..1e7974bc21 100644 --- a/files/assets/css/tron.css +++ b/files/assets/css/tron.css @@ -233,3 +233,8 @@ h5.post-title a:visited { color: #b0b0b0 !important; } + +.blueish { + background-color: #312e49 !important; + border-left: 10px solid #312e49 !important; +} diff --git a/files/routes/search.py b/files/routes/search.py index 3beff1d212..84b67ca174 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -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] diff --git a/files/routes/users.py b/files/routes/users.py index 9e4ee28711..8bd55487ad 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -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: diff --git a/files/templates/comments.html b/files/templates/comments.html index aeda40ec70..8b38fd785b 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -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 %} -
{% if not isreply %} {% endif %}
-
+