mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-03 00:31:35 -07:00
DOCS+FE+BE: cleanup, SSE wait for app initialization #1440
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -231,7 +231,7 @@ def get_unread_notifications():
|
||||
notifications = json.load(f)
|
||||
|
||||
unread = [n for n in notifications if n.get("read", 0) == 0]
|
||||
return jsonify(unread)
|
||||
return unread
|
||||
|
||||
|
||||
def mark_notification_as_read(guid=None, max_attempts=3):
|
||||
@@ -283,6 +283,13 @@ def mark_notification_as_read(guid=None, max_attempts=3):
|
||||
return {"success": False, "error": error_msg}
|
||||
|
||||
|
||||
def update_unread_notifications_count():
|
||||
"""
|
||||
Re-broadcast unread notifications for the frontend .
|
||||
"""
|
||||
broadcast_unread_notifications_count(len(get_unread_notifications()))
|
||||
|
||||
|
||||
def delete_notification(guid):
|
||||
"""
|
||||
Delete a notification from the notifications file based on its GUID.
|
||||
|
||||
Reference in New Issue
Block a user