diff --git a/files/routes/front.py b/files/routes/front.py
index 38f007c61a..c57ff7dbb3 100644
--- a/files/routes/front.py
+++ b/files/routes/front.py
@@ -102,6 +102,7 @@ def notifications(v):
g.db.add(c)
g.db.commit()
+ print("1: " + str(time.time() - t), flush=True)
all = set(x[0] for x in g.db.query(Notification.comment_id).join(Comment, Notification.comment_id == Comment.id).filter(Comment.is_banned == False,
Comment.deleted_utc == 0,
@@ -109,6 +110,8 @@ def notifications(v):
Comment.body_html.notlike('
New rdrama mention: 25)
comments = comments[:25]
- print("1: " + str(time.time() - t), flush=True)
+ print("3: " + str(time.time() - t), flush=True)
cids = set()
listing = []
@@ -128,12 +131,12 @@ def notifications(v):
if c.parent_submission:
if not c.replies2:
c.replies2 = c.child_comments.filter(or_(Comment.author_id == v.id, Comment.id.in_(all))).all()
- cids.update(x.id for x in c.replies2)
+ cids = cids | set(x.id for x in c.replies2)
while c.parent_comment and (c.parent_comment.author_id == v.id or c.parent_comment in comments):
c = c.parent_comment
if not c.replies2:
c.replies2 = c.child_comments.filter(or_(Comment.author_id == v.id, Comment.id.in_(all))).all()
- cids.update(x.id for x in c.replies2)
+ cids = cids | set(x.id for x in c.replies2)
cids.add(c.id)
else:
while c.parent_comment:
@@ -142,13 +145,13 @@ def notifications(v):
if c not in listing: listing.append(c)
- print("2: " + str(time.time() - t), flush=True)
+ print("4: " + str(time.time() - t), flush=True)
comms = get_comments(list(cids), v=v)
if request.headers.get("Authorization"): return {"data":[x.json for x in listing]}
- print("3: " + str(time.time() - t), flush=True)
+ print("5: " + str(time.time() - t), flush=True)
return render_template("notifications.html",
v=v,
notifications=listing,