master
Aevann1 2022-04-04 00:33:49 +02:00
parent f37314964f
commit 3663579cf8
1 changed files with 12 additions and 15 deletions

View File

@ -89,12 +89,19 @@ def notifications(v):
next_exists = (len(notifications) > len(listing))
else:
notifications = v.notifications.join(Notification.comment).filter(
all = set([x.comment_id for x in v.notifications.join(Notification.comment).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(Notification.created_utc.desc()).offset(50 * (page - 1)).limit(51).all()
).order_by(Comment.top_comment_id.desc()).offset(50 * (page - 1)).limit(100).all()])
notifications = v.notifications.join(Notification.comment).distinct(Comment.top_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(51).all()
next_exists = (len(notifications) > 50)
notifications = notifications[:50]
@ -116,20 +123,10 @@ def notifications(v):
listing = []
for c in comments:
if c.parent_submission:
if c.replies2 == None: c.replies2 = []
for x in c.child_comments:
if x.author_id == v.id:
x.voted = 1
if x not in c.replies2: c.replies2.append(x)
while c.parent_comment and (c.parent_comment.author_id == v.id or c.parent_comment in comments):
parent = c.parent_comment
if parent.replies2 == None: parent.replies2 = [c]
elif c not in parent.replies2: parent.replies2.append(c)
c = parent
if c.replies2 == None: c.replies2 = []
c = c.parent_comment
c.replies2 = [x for x in c.child_comments if c.author_id == v.id or x.id in all]
c.replies2 = [x for x in c.child_comments if c.author_id == v.id or x.id in all]
else:
while c.parent_comment:
c = c.parent_comment