forked from rDrama/rDrama
1
0
Fork 0

notif fix

master
Aevann 2023-03-10 01:41:57 +02:00
parent 8295b3ac39
commit d8575791be
1 changed files with 22 additions and 17 deletions

View File

@ -110,6 +110,8 @@ def notifications_messages(v:User):
.offset(PAGE_SIZE*(page-1)).limit(PAGE_SIZE+1).all()
# Clear notifications (used for unread indicator only) for all user messages.
if not session.get("GLOBAL"):
notifs_unread_row = g.db.query(Notification.comment_id).join(Comment).filter(
Notification.user_id == v.id,
Notification.read == False,
@ -173,6 +175,7 @@ def notifications_posts(v:User):
for p in listing:
p.unread = p.created_utc > v.last_viewed_post_notifs
if not session.get("GLOBAL"):
v.last_viewed_post_notifs = int(time.time())
g.db.add(v)
@ -221,6 +224,7 @@ def notifications_modactions(v:User):
for ma in listing:
ma.unread = ma.created_utc > v.last_viewed_log_notifs
if not session.get("GLOBAL"):
v.last_viewed_log_notifs = int(time.time())
g.db.add(v)
@ -257,6 +261,7 @@ def notifications_reddit(v:User):
for ma in listing:
ma.unread = ma.created_utc > v.last_viewed_reddit_notifs
if not session.get("GLOBAL"):
v.last_viewed_reddit_notifs = int(time.time())
g.db.add(v)