remotes/1693045480750635534/spooky-22
Aevann1 2022-04-04 01:34:37 +02:00
parent 5540d82ce1
commit 89cb8aa4a1
1 changed files with 9 additions and 9 deletions

View File

@ -94,8 +94,8 @@ def notifications(v):
Notification.read == False,
Notification.user_id == v.id,
Comment.author_id != AUTOJANNY_ID,
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
)
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%'))
for n, c in unread:
n.read = True
c.unread = True
@ -103,11 +103,11 @@ def notifications(v):
g.db.commit()
all = g.db.query(Comment).join(Notification, Notification.comment_id == Comment.id).filter(Comment.is_banned == False,
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,
Comment.author_id != AUTOJANNY_ID,
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
).order_by(Comment.top_comment_id.desc()).offset(50 * (page - 1)).limit(100).all()
).order_by(Comment.top_comment_id.desc()).offset(50 * (page - 1)).limit(100).all())
comments = g.db.query(Comment).join(Notification).distinct(Comment.top_comment_id).filter(
Notification.user_id == v.id,
@ -115,20 +115,20 @@ def notifications(v):
Comment.deleted_utc == 0,
Comment.author_id != AUTOJANNY_ID,
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
).order_by(Comment.top_comment_id.desc()).offset(50 * (page - 1)).limit(51).all()
).order_by(Comment.top_comment_id.desc()).offset(25 * (page - 1)).limit(26).all()
next_exists = (len(comments) > 50)
comments = comments[:50]
next_exists = (len(comments) > 25)
comments = comments[:25]
cids = set()
listing = []
for c in comments:
if c.parent_submission:
c.replies2 = [x for x in all if x.parent_comment_id == c.id]
c.replies2 = [x for x in c.child_comments if c.author_id == v.id or x.id in all]
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
c.replies2 = [x for x in all if x.parent_comment_id == c.id]
c.replies2 = [x for x in c.child_comments if c.author_id == v.id or x.id in all]
cids = cids | set(x.id for x in c.replies2)
cids.add(c.id)
else: