Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost

master
Aevann1 2022-09-17 22:23:55 +00:00
commit b1579c61a1
7 changed files with 15 additions and 12 deletions

View File

@ -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")

View File

@ -52,8 +52,8 @@ snappy_youtube_regex = re.compile('<lite-youtube videoid="(.+?)" params="autopla
email_regex = re.compile('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}', flags=re.A|re.I)
utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&', flags=re.A)
utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A)
utm_regex = re.compile('utm_[0-z]+=[0-z_]+&', flags=re.A)
utm_regex2 = re.compile('[?&]utm_[0-z]+=[0-z_]+', flags=re.A)
slur_regex = re.compile(f"<[^>]*>|{single_words}", flags=re.I|re.A)
slur_regex_upper = re.compile(f"<[^>]*>|{single_words.upper()}", flags=re.A)

View File

@ -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]}

View File

@ -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)

View File

@ -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}'

View File

@ -48,8 +48,8 @@
<li><a href="/agendaposters">Users with Chud Theme</a></li>
<li><a href="/grassed">Currently Grassed Users</a></li>
{%- endif %}
{% if FEATURES['PROCOINS'] -%}
<li><a href="/patrons">Patrons / Paypigs</a></li>
{% if FEATURES['PROCOINS'] and (not AEVANN_ID or v.id == AEVANN_ID) -%}
<li><a href="/patrons">Patrons</a></li>
{%- endif %}
<li><a href="/admin/loggedin">Currently Logged-in Users</a></li>
<li><a href="/admin/loggedout">Currently Logged-out Users</a></li>

View File

@ -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 %}
<div id="comment-{{c.id}}" class="anchor comment {% if standalone and level==1 %} mt-0{% endif %} {% if c.collapse_for_user(v,request.full_path) %}collapsed{% endif %}" style="{% if isreply %}padding-left:0!important;{% else %}border-left: 2px solid {% if c.ghost %}var(--primary){% else %}#{{c.author.name_color}};{% endif %}{% endif %}">
<div id="comment-{{c.id}}" class="anchor comment {% if 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;{% else %}border-left: 2px solid {% if c.ghost %}var(--primary){% else %}#{{c.author.name_color}};{% endif %}{% endif %}">
{% if not isreply %}
<span class="comment-collapse-desktop d-none d-md-block" style="border-left: 2px solid {% if c.ghost %}var(--primary){% else %}#{{c.author.name_color}}{% endif %}" onclick="collapse_comment('{{c.id}}', this.parentElement)"></span>
{% endif %}
@ -553,7 +553,11 @@
{% if render_replies %}
<div id="replies-of-{{c.fullname}}">
{% 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 %}