From 6f6b3cf8413d57b7340023ba289826cd431c0c91 Mon Sep 17 00:00:00 2001 From: Yansong Zhang <916125788@qq.com> Date: Wed, 4 Mar 2026 12:02:38 +0800 Subject: [PATCH 1/4] fix comment --- api/services/billing_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/services/billing_service.py b/api/services/billing_service.py index b853dc0b81..d39697e536 100644 --- a/api/services/billing_service.py +++ b/api/services/billing_service.py @@ -428,7 +428,7 @@ class BillingService: ) -> dict: """Create or update a notification. - contents: list of {"lang": str, "title": str, "body": str, "cta_label": str, "cta_url": str} + contents: list of {"lang": str, "title": str, "subtitle": str, "body": str, "title_pic_url": str} start_time / end_time: RFC3339 strings (e.g. "2026-03-01T00:00:00Z"), optional. Returns {"notification_id": str}. """ From 6f890496fa63e150cf75851dc83ee07a5094e717 Mon Sep 17 00:00:00 2001 From: Yansong Zhang <916125788@qq.com> Date: Wed, 4 Mar 2026 12:03:52 +0800 Subject: [PATCH 2/4] fix comment --- api/services/billing_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/services/billing_service.py b/api/services/billing_service.py index d39697e536..5ab47c799a 100644 --- a/api/services/billing_service.py +++ b/api/services/billing_service.py @@ -407,7 +407,7 @@ class BillingService: "notification": { # present only when should_show=true "notification_id": str, "contents": { # lang -> LangContent - "en": {"lang": "en", "title": ..., "body": ..., "cta_label": ..., "cta_url": ...}, + "en": {"lang": "en", "title": ..., "subtitle": ..., "body": ..., "title_pic_url": ...}, ... }, "frequency": "once" | "every_page_load" From 9e7aeb36ca616db15ae87ad9687454187b53fe56 Mon Sep 17 00:00:00 2001 From: Yansong Zhang <916125788@qq.com> Date: Mon, 9 Mar 2026 17:28:49 +0800 Subject: [PATCH 3/4] fix lang notification --- api/controllers/console/notification.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/api/controllers/console/notification.py b/api/controllers/console/notification.py index ab8a3c82f2..0f3517cdd9 100644 --- a/api/controllers/console/notification.py +++ b/api/controllers/console/notification.py @@ -8,25 +8,7 @@ from libs.login import current_account_with_tenant, login_required from services.billing_service import BillingService # Notification content is stored under three lang tags. -_FALLBACK_LANG = "en" - -# Maps dify interface_language prefixes to notification lang tags. -# Any unrecognised prefix falls back to _FALLBACK_LANG. -_LANG_MAP: dict[str, str] = { - "zh": "zh", - "ja": "jp", -} - - -def _resolve_lang(interface_language: str | None) -> str: - """Derive the notification lang tag from the user's interface_language. - - e.g. "zh-Hans" → "zh", "ja-JP" → "jp", "en-US" / None → "en" - """ - if not interface_language: - return _FALLBACK_LANG - prefix = interface_language.split("-")[0].lower() - return _LANG_MAP.get(prefix, _FALLBACK_LANG) +_FALLBACK_LANG = "en-US" def _pick_lang_content(contents: dict, lang: str) -> dict: @@ -66,7 +48,7 @@ class NotificationApi(Resource): if not result.get("shouldShow"): return {"should_show": False, "notifications": []}, 200 - lang = _resolve_lang(current_user.interface_language) + lang = current_user.interface_language notifications = [] for notification in result.get("notifications") or []: From 65b2e8c525c4d3e496c93d4379961dcddeaaa89d Mon Sep 17 00:00:00 2001 From: Yansong Zhang <916125788@qq.com> Date: Mon, 9 Mar 2026 17:44:10 +0800 Subject: [PATCH 4/4] fix lang notification --- api/controllers/console/notification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/controllers/console/notification.py b/api/controllers/console/notification.py index 0f3517cdd9..53e4aa3d86 100644 --- a/api/controllers/console/notification.py +++ b/api/controllers/console/notification.py @@ -48,7 +48,7 @@ class NotificationApi(Resource): if not result.get("shouldShow"): return {"should_show": False, "notifications": []}, 200 - lang = current_user.interface_language + lang = current_user.interface_language or _FALLBACK_LANG notifications = [] for notification in result.get("notifications") or []: