fd
This commit is contained in:
parent
4fb2283352
commit
556a3b8c7d
1 changed files with 7 additions and 4 deletions
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue