fix(email): complete mail settings and templates

This commit is contained in:
2026-09-04 12:06:42 +08:00
parent 4f8ab94fac
commit 4833053a5c
29 changed files with 716 additions and 426 deletions
+13 -3
View File
@@ -540,9 +540,15 @@ class SchemaProvider {
$data = $this->collect_defaults($schema);
foreach ($this->get_all_fields($schema) as $field) {
if (array_key_exists($field['key'], $stored)) {
$data[$field['key']] = $stored[$field['key']];
}
if (array_key_exists($field['key'], $stored)) {
$stored_value = $stored[$field['key']];
$is_mail_template = $option_key === 'aksrt_settings'
&& preg_match('/^email_.+_(subject|content)$/', (string) $field['key']);
if (!$is_mail_template || trim((string) $stored_value) !== '') {
$data[$field['key']] = $stored_value;
}
}
$stored_value = array_key_exists($field['key'], $stored) ? $stored[$field['key']] : ($data[$field['key']] ?? '');
if (!empty($field['secret'])) {
$data[$field['key']] = trim((string) $stored_value) !== '' ? '***' : '';
@@ -732,6 +738,10 @@ class SchemaProvider {
if (!is_array($field) || empty($field['key'])) {
continue;
}
// UI-only controls never become persisted settings keys.
if (!empty($field['ui_only'])) {
continue;
}
// Notice/help-only rows are UI chrome, not stored settings keys.
if (($field['type'] ?? '') === 'notice') {
continue;