From 0e3a5c3d3cc0ec4c2a0da9b971f8a9d51879d3f2 Mon Sep 17 00:00:00 2001 From: Son Date: Wed, 9 Mar 2022 17:58:26 +0100 Subject: [PATCH] mark a notification as read when user arrives on the notification page --- app/dashboard/views/notification.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/dashboard/views/notification.py b/app/dashboard/views/notification.py index 82270e4f..e22c8e2c 100644 --- a/app/dashboard/views/notification.py +++ b/app/dashboard/views/notification.py @@ -23,6 +23,10 @@ def notification_route(notification_id): ) return redirect(url_for("dashboard.index")) + if not notification.read: + notification.read = True + Session.commit() + if request.method == "POST": notification_title = notification.title or notification.message[:20] Notification.delete(notification_id)