From 97b51b81cdbb33a027729fc6f410f1cc826e4ea7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 16 Sep 2021 19:36:14 +0200 Subject: [PATCH] fd --- files/routes/front.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/routes/front.py b/files/routes/front.py index a5e294fb91..c4b0e1df4d 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -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() comments = [] + notifs = [] + for index, x in enumerate(notifications): c = x.comment if x.read and index > 26: break elif not x.read: c.unread = True + notifs.append({'id': x.id, 'read': True}) x.read = True g.db.add(x) comments.append(c) + + session.bulk_update_mappings(User, notifs) next_exists = (len(comments) > 25) listing = comments[:25] else: