feat(humanInput): update email configuration defaults and remove validation tooltip

This commit is contained in:
twwu 2026-01-28 22:43:58 +08:00
parent 2ac20ced26
commit b1f7602dc8
5 changed files with 3 additions and 31 deletions

View File

@ -40,7 +40,7 @@ const EmailConfigureModal = ({
const email = useAppContextWithSelector(s => s.userProfile.email)
const [recipients, setRecipients] = useState(config?.recipients || { whole_workspace: false, items: [] })
const [subject, setSubject] = useState(config?.subject || '')
const [body, setBody] = useState(config?.body || '')
const [body, setBody] = useState(config?.body || '{{#url#}}')
const [debugMode, setDebugMode] = useState(config?.debug_mode || false)
const checkValidConfig = useCallback(() => {

View File

@ -70,30 +70,15 @@ const DeliveryMethodItem: FC<DeliveryMethodItemProps> = ({
})
}
const isEmailConfigComplete = useMemo(() => {
if (method.type !== DeliveryMethodType.Email || !method.config)
return false
const config = method.config as EmailConfig
const hasSubject = !!config.subject
const hasBody = !!config.body
const hasRecipients = config.recipients?.whole_workspace || (config.recipients?.items?.length > 0)
return hasSubject && hasBody && hasRecipients
}, [method.type, method.config])
const emailSenderTooltipContent = useMemo(() => {
if (method.type !== DeliveryMethodType.Email) {
return ''
}
if (!isEmailConfigComplete) {
return t(`${i18nPrefix}.deliveryMethod.emailSender.configIncomplete`, { ns: 'workflow' })
}
if (method.config?.debug_mode) {
return t(`${i18nPrefix}.deliveryMethod.emailSender.testSendTipInDebugMode`, { ns: 'workflow', email })
}
return t(`${i18nPrefix}.deliveryMethod.emailSender.testSendTip`, { ns: 'workflow' })
}, [method.type, method.config?.debug_mode, isEmailConfigComplete, t, email])
}, [method.type, method.config?.debug_mode, t, email])
const jumpToEmailConfigModal = useCallback(() => {
setShowTestEmailModal(false)
@ -135,10 +120,8 @@ const DeliveryMethodItem: FC<DeliveryMethodItemProps> = ({
needsDelay={false}
>
<ActionButton
disabled={!isEmailConfigComplete}
onClick={() => {
if (isEmailConfigComplete)
setShowTestEmailModal(true)
setShowTestEmailModal(true)
}}
>
<RiSendPlane2Line className="h-4 w-4" />

View File

@ -132,15 +132,6 @@ const MethodSelector: FC<MethodSelectorProps> = ({
id: uuid4(),
type: DeliveryMethodType.Email,
enabled: false,
config: {
body: '{{#url#}}',
recipients: {
whole_workspace: false,
items: [],
},
subject: '',
debug_mode: false,
},
})
}}
>

View File

@ -525,7 +525,6 @@
"nodes.humanInput.deliveryMethod.emailConfigure.subject": "Subject",
"nodes.humanInput.deliveryMethod.emailConfigure.subjectPlaceholder": "Enter email subject",
"nodes.humanInput.deliveryMethod.emailConfigure.title": "Email Configuration",
"nodes.humanInput.deliveryMethod.emailSender.configIncomplete": "Please complete email configuration first (subject, body, and recipients)",
"nodes.humanInput.deliveryMethod.emailSender.debugDone": "A test email has been sent to <email>{{email}}</email>. Please check your inbox.",
"nodes.humanInput.deliveryMethod.emailSender.debugModeTip": "Debug mode is enabled.",
"nodes.humanInput.deliveryMethod.emailSender.debugModeTip2": "Email will be sent to <email>{{email}}</email>.",

View File

@ -525,7 +525,6 @@
"nodes.humanInput.deliveryMethod.emailConfigure.subject": "邮件主题",
"nodes.humanInput.deliveryMethod.emailConfigure.subjectPlaceholder": "输入邮件主题",
"nodes.humanInput.deliveryMethod.emailConfigure.title": "电子邮件配置",
"nodes.humanInput.deliveryMethod.emailSender.configIncomplete": "请先完成邮件配置(主题、正文和收件人)",
"nodes.humanInput.deliveryMethod.emailSender.debugDone": "测试邮件已发送到 <email>{{email}}</email>。请检查您的收件箱。",
"nodes.humanInput.deliveryMethod.emailSender.debugModeTip": "调试模式已启用。",
"nodes.humanInput.deliveryMethod.emailSender.debugModeTip2": "邮件将发送到 <email>{{email}}</email>。",