forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-16 19:41:48 +02:00
parent da2e085a32
commit 9a6fc86369
1 changed files with 7 additions and 4 deletions

View File

@ -43,6 +43,8 @@ def notifications(v):
comments.append(c) comments.append(c)
g.db.bulk_update_mappings(Notification, notifs) g.db.bulk_update_mappings(Notification, notifs)
g.db.commit()
next_exists = (len(comments) > 25) next_exists = (len(comments) > 25)
listing = comments[:25] listing = comments[:25]
else: else:
@ -58,15 +60,18 @@ def notifications(v):
cids = [x.comment_id for x in notifications] cids = [x.comment_id for x in notifications]
comments = get_comments(cids, v=v, load_parent=True) comments = get_comments(cids, v=v, load_parent=True)
notifs = []
i = 0 i = 0
for x in notifications: for x in notifications:
try: try:
if not x.read: comments[i].unread = True if not x.read: comments[i].unread = True
except: continue except: continue
x.read = True notifs.append({'id': x.id, 'read': True})
g.db.add(x)
i += 1 i += 1
g.db.bulk_update_mappings(Notification, notifs)
g.db.commit()
if not posts: if not posts:
listing = [] listing = []
for c in comments: for c in comments:
@ -96,8 +101,6 @@ def notifications(v):
listing.append(c) listing.append(c)
g.db.commit()
return render_template("notifications.html", return render_template("notifications.html",
v=v, v=v,
notifications=listing, notifications=listing,