fd
This commit is contained in:
parent
affba6fac0
commit
1c1f9d7d92
1 changed files with 5 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue