From e2808e4026e1e2481b81ed3b7e692163f857c650 Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Tue, 14 Jan 2025 10:56:07 +0100 Subject: [PATCH] fix(Nextcloud): Use current notification app name, handle `admin_notifications` - The first notification's app name was used (leftover from testing) instead of the current one. - `admin_notifications` now display properly --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d62abf3..8a6fb99 100644 --- a/main.py +++ b/main.py @@ -171,7 +171,11 @@ def main(): last_datetime = datetime.fromisoformat(notification["datetime"]) log.info("New notifications received.") - title = f"Nextcloud - {translate_app_name(data["ocs"]["data"][0]["app"])}: {data["ocs"]["data"][0]["subject"]}" + title = "" + if notification["app"] == "admin_notifications": + title = f"Nextcloud: {notification["subject"]}" + else: + title = f"Nextcloud - {translate_app_name(notification["app"])}: {notification["subject"]}" log.debug(f"Notification title: {title}") message = notification["message"]