forked from rDrama/rDrama
master
parent
e36b524530
commit
424adaa673
|
@ -47,24 +47,26 @@ def notifications(v):
|
||||||
next_exists = (len(comments) > 100)
|
next_exists = (len(comments) > 100)
|
||||||
listing = comments[:100]
|
listing = comments[:100]
|
||||||
else:
|
else:
|
||||||
|
|
||||||
notifications = v.notifications.join(Notification.comment).filter(
|
notifications = v.notifications.join(Notification.comment).filter(
|
||||||
Comment.is_banned == False,
|
Comment.is_banned == False,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.author_id != AUTOJANNY_ACCOUNT,
|
Comment.author_id != AUTOJANNY_ACCOUNT,
|
||||||
).order_by(Notification.id.desc()).offset(100 * (page - 1)).all()
|
).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26).all()
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
comments = []
|
i = 0
|
||||||
for index, x in enumerate(notifications):
|
for x in notifications:
|
||||||
c = x.comment
|
try:
|
||||||
if x.read and index > 101: break
|
if not x.read: comments[i].unread = True
|
||||||
elif not x.read:
|
except: continue
|
||||||
c.unread = True
|
x.read = True
|
||||||
x.read = True
|
g.db.add(x)
|
||||||
g.db.add(x)
|
i += 1
|
||||||
comments.append(c)
|
|
||||||
next_exists = (len(comments) > 100)
|
|
||||||
listing = comments[:100]
|
|
||||||
|
|
||||||
if not posts:
|
if not posts:
|
||||||
listing = []
|
listing = []
|
||||||
|
|
Loading…
Reference in New Issue