From 87c30bd1eead294b8ad18e879be10f3b87378b76 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sat, 17 Sep 2022 14:13:14 -0700 Subject: [PATCH 1/5] fix utm regex (#357) --- files/helpers/regex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 8d50bca90..180546140 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -52,8 +52,8 @@ snappy_youtube_regex = re.compile(']*>|{single_words}", flags=re.I|re.A) slur_regex_upper = re.compile(f"<[^>]*>|{single_words.upper()}", flags=re.A) From dc6f4f8e10873aceead1616aa24266a65ac193da Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 17 Sep 2022 23:45:17 +0200 Subject: [PATCH 2/5] do this https://rdrama.net/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/2723089?context=8#context --- files/classes/comment.py | 1 - files/templates/comments.html | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 4d4592eaf..4601ad2d1 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -67,7 +67,6 @@ class Comment(Base): post = relationship("Submission", back_populates="comments") author = relationship("User", primaryjoin="User.id==Comment.author_id") senttouser = relationship("User", primaryjoin="User.id==Comment.sentto") - top_comment = relationship("Comment", primaryjoin="Comment.id==Comment.top_comment_id") parent_comment = relationship("Comment", remote_side=[id], back_populates="child_comments") child_comments = relationship("Comment", order_by="Comment.stickied, Comment.realupvotes.desc()", remote_side=[parent_comment_id], back_populates="parent_comment") awards = relationship("AwardRelationship", order_by="AwardRelationship.awarded_utc.desc()", back_populates="comment") diff --git a/files/templates/comments.html b/files/templates/comments.html index f168d4b4e..1bb01ba3a 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -15,7 +15,7 @@ {% include "popover.html" %} {% endif %} -{% macro single_comment(c, level=1) %} +{% macro single_comment(c, level=1, collapse=False) %} {% set ups=c.upvotes %} {% set downs=c.downvotes %} @@ -114,7 +114,7 @@ {% set isreply = False %} {% endif %} -
+
{% if not isreply %} {% endif %} @@ -553,7 +553,11 @@ {% if render_replies %}
- {% if level<9 or request.path.startswith('/notifications') %} + {% if request.path.startswith('/notifications') and replies|length > 8 %} + {% for reply in replies %} + {{single_comment(reply, level=level+1, collapse=(not reply.unread and loop.index != replies|length))}} + {% endfor %} + {% elif request.path.startswith('/notifications') or level < 9 %} {% for reply in replies %} {{single_comment(reply, level=level+1)}} {% endfor %} From d1e391683bc891774ae98e160849e20cc4a34733 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 17 Sep 2022 23:59:49 +0200 Subject: [PATCH 3/5] fix unread attribute --- files/routes/notifications.py | 2 ++ files/routes/users.py | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/files/routes/notifications.py b/files/routes/notifications.py index a6461e5d1..ef78f3de1 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -111,9 +111,11 @@ def notifications_messages(v): next_exists = (len(message_threads) > 25) listing = message_threads[:25] + list_to_perserve_unread_attribute = [] comments_unread = g.db.query(Comment).filter(Comment.id.in_(notifs_unread)) for c in comments_unread: c.unread = True + list_to_perserve_unread_attribute.append(c) if request.headers.get("Authorization"): return {"data":[x.json for x in listing]} diff --git a/files/routes/users.py b/files/routes/users.py index 92cfb5a2c..8fa49aa94 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -810,10 +810,6 @@ def messagereply(v): if not notif: notif = Notification(comment_id=c.id, user_id=user_id) g.db.add(notif) - ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies(None)] - notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id == user_id) - for n in notifications: - g.db.delete(n) if PUSHER_ID != 'blahblahblah' and not v.shadowbanned: interests = f'{SITE}{user_id}' From 6bd0043248b3c5386677280fb2379fbbfb5f35c5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 18 Sep 2022 00:06:29 +0200 Subject: [PATCH 4/5] sneed --- files/routes/static.py | 2 ++ files/templates/admin/admin_home.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/routes/static.py b/files/routes/static.py index fba2d7b09..20469cb5b 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -106,6 +106,8 @@ def daily_chart(v): @app.get("/paypigs") @admin_level_required(3) def patrons(v): + if AEVANN_ID and v.id != AEVANN_ID: abort(404) + users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc(), User.id).all() return render_template("patrons.html", v=v, users=users) diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index ff2d0bebe..71216d95f 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -48,7 +48,7 @@
  • Users with Chud Theme
  • Currently Grassed Users
  • {%- endif %} - {% if FEATURES['PROCOINS'] -%} + {% if FEATURES['PROCOINS'] and (not AEVANN_ID or v.id == AEVANN_ID) -%}
  • Patrons / Paypigs
  • {%- endif %}
  • Currently Logged-in Users
  • From 3f2f3838c7df2bea430821351345990b581a786d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 18 Sep 2022 00:06:49 +0200 Subject: [PATCH 5/5] sneed --- files/templates/admin/admin_home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 71216d95f..4397e89d2 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -49,7 +49,7 @@
  • Currently Grassed Users
  • {%- endif %} {% if FEATURES['PROCOINS'] and (not AEVANN_ID or v.id == AEVANN_ID) -%} -
  • Patrons / Paypigs
  • +
  • Patrons
  • {%- endif %}
  • Currently Logged-in Users
  • Currently Logged-out Users