From a552386463286a797ac2ad952f57cbbe418dc377 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 11 Nov 2021 02:26:25 +0200 Subject: [PATCH] dsffds --- files/routes/front.py | 9 +++++++++ files/templates/notifications.html | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 3514c03c4..c8301ff7d 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -11,6 +11,15 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() def slash_post(): return redirect("/") +@app.post("/clear") +@auth_required +def clear(v): + for n in v.notifications.filter_by(read=False).all(): + n.read = True + g.db.add(n) + g.db.commit() + return {"message": "Notifications cleared!"} + @app.get("/notifications") @auth_required def notifications(v): diff --git a/files/templates/notifications.html b/files/templates/notifications.html index d50c91c02..4f4a635d3 100644 --- a/files/templates/notifications.html +++ b/files/templates/notifications.html @@ -41,9 +41,10 @@ -
-

Inbox

+Clear all notifications + +
{% with comments=notifications %} {% include "comments.html" %}