forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-11-14 04:27:55 +02:00
parent bc66560012
commit b07cf62d37
1 changed files with 17 additions and 14 deletions

View File

@ -55,22 +55,25 @@ def notifications(v):
next_exists = (len(notifications) > len(listing)) next_exists = (len(notifications) > len(listing))
else: else:
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id != AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(101).all() notifications = v.notifications.join(Notification.comment).filter(
Comment.is_banned == False,
Comment.deleted_utc == 0,
Comment.author_id != AUTOJANNY_ACCOUNT,
).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26).all()
comments = [] next_exists = (len(notifications) > 25)
notifications = notifications[:25]
cids = [x.comment_id for x in notifications]
comments = get_comments(cids, v=v, load_parent=True)
for index, x in enumerate(notifications[:100]): i = 0
c = x.comment for x in notifications:
if x.read and index > 24: break try:
elif not x.read: if not x.read: comments[i].unread = True
x.read = True except: continue
c.unread = True x.read = True
g.db.add(x) g.db.add(x)
comments.append(c) i += 1
g.db.commit()
next_exists = (len(notifications) > len(comments))
if not posts: if not posts:
listing = [] listing = []