forked from rDrama/rDrama
master
parent
329e5939a7
commit
97b51b81cd
|
@ -32,14 +32,19 @@ def notifications(v):
|
||||||
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26).all()
|
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26).all()
|
||||||
|
|
||||||
comments = []
|
comments = []
|
||||||
|
notifs = []
|
||||||
|
|
||||||
for index, x in enumerate(notifications):
|
for index, x in enumerate(notifications):
|
||||||
c = x.comment
|
c = x.comment
|
||||||
if x.read and index > 26: break
|
if x.read and index > 26: break
|
||||||
elif not x.read:
|
elif not x.read:
|
||||||
c.unread = True
|
c.unread = True
|
||||||
|
notifs.append({'id': x.id, 'read': True})
|
||||||
x.read = True
|
x.read = True
|
||||||
g.db.add(x)
|
g.db.add(x)
|
||||||
comments.append(c)
|
comments.append(c)
|
||||||
|
|
||||||
|
session.bulk_update_mappings(User, notifs)
|
||||||
next_exists = (len(comments) > 25)
|
next_exists = (len(comments) > 25)
|
||||||
listing = comments[:25]
|
listing = comments[:25]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue