Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(api): add zh-Hans account deletion success template (#43504)

lorenzozane712f601dff35
diff --git a/api/templates/delete_account_success_template_zh-CN.html b/api/templates/delete_account_success_template_zh-CN.html
new file mode 100644
index 00000000000..732673156fa
--- /dev/null
+++ b/api/templates/delete_account_success_template_zh-CN.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <style>
+ body {
+ font-family: 'Arial', sans-serif;
+ line-height: 16pt;
+ color: #101828;
+ background-color: #e9ebf0;
+ margin: 0;
+ padding: 0;
+ }
+
+ .container {
+ width: 600px;
+ min-height: 380px;
+ margin: 40px auto;
+ padding: 36px 48px;
+ background-color: #fcfcfd;
+ border-radius: 16px;
+ border: 1px solid #ffffff;
+ box-shadow: 0 2px 4px -2px rgba(9, 9, 11, 0.08);
+ }
+
+ .header {
+ margin-bottom: 24px;
+ }
+
+ .header img {
+ max-width: 100px;
+ height: auto;
+ }
+
+ .title {
+ font-weight: 600;
+ font-size: 24px;
+ line-height: 28.8px;
+ margin-bottom: 12px;
+ }
+
+ .typography {
+ font-weight: 400;
+ font-style: normal;
+ font-size: 14px;
+ line-height: 20px;
+ color: #354052;
+ margin-top: 4px;
+ margin-bottom: 0;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="container">
+ <div class="header">
+ <img src="https://assets.dify.ai/images/logo.png" alt="Dify Logo" />
+ </div>
+ <p class="title">您的 Dify.AI 账户已成功删除</p>
+ <p class="typography">我们写信确认,您的 Dify.AI 账户已根据您的请求成功删除。您的账户已无法访问,您也不能再使用之前的凭据登录。如果您将来希望继续使用 Dify.AI 服务,需要在 30 天后重新创建账户。感谢您曾使用 Dify.AI,也对您的离开感到遗憾。有关删除流程的任何问题或疑虑,请随时联系我们的支持团队。</p>
+ <p class="typography">感谢您曾是 Dify.AI 社区的一员。</p>
+ <p class="typography">此致</p>
+ <p class="typography">Dify.AI 团队</p>
+ </div>
+</body>
+
+</html>
diff --git a/api/tests/unit_tests/libs/test_email_i18n.py b/api/tests/unit_tests/libs/test_email_i18n.py
index c8d94c13c73..0a055cad513 100644
--- a/api/tests/unit_tests/libs/test_email_i18n.py
+++ b/api/tests/unit_tests/libs/test_email_i18n.py
@@ -5,10 +5,12 @@ Tests the email internationalization service with mocked dependencies
following Domain-Driven Design principles.
"""
+from pathlib import Path
from typing import Any
from unittest.mock import MagicMock
import pytest
+from flask import Flask
from libs.email_i18n import (
EmailI18nConfig,
@@ -572,3 +574,30 @@ class TestEmailI18nIntegration:
finally:
# Restore original mail
libs.email_i18n.mail = original_mail
+
+
[email protected]("branding_enabled", [False, True])
+def test_account_deletion_success_email_renders_chinese_template(branding_enabled: bool):
+ app = Flask(__name__, template_folder=str(Path(__file__).resolve().parents[3] / "templates"))
+ sender = MockEmailSender()
+ service = EmailI18nService(
+ config=create_default_email_config(),
+ renderer=FlaskEmailRenderer(),
+ branding_service=MockBrandingService(enabled=branding_enabled),
+ sender=sender,
+ )
+
+ with app.app_context():
+ service.send_email(
+ email_type=EmailType.ACCOUNT_DELETION_SUCCESS,
+ language_code="zh-Hans",
+ template_context={"to": "[email protected]", "email": "[email protected]"},
+ )
+
+ assert len(sender.sent_emails) == 1
+ sent_email = sender.sent_emails[0]
+ assert sent_email["to"] == "[email protected]"
+ assert sent_email["subject"] == "您的 Dify.AI 账户已成功删除"
+ assert "您的 Dify.AI 账户已成功删除" in sent_email["html_content"]
+ assert "30 天后" in sent_email["html_content"]