fix(email): lock templates to built-in catalog

This commit is contained in:
2026-09-13 20:02:56 +08:00
parent 3f02048bc5
commit 129eb25078
10 changed files with 61 additions and 111 deletions
+4 -8
View File
@@ -540,16 +540,12 @@ class SchemaProvider {
$data = $this->collect_defaults($schema);
foreach ($this->get_all_fields($schema) as $field) {
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;
}
}
if (array_key_exists($field['key'], $stored)) {
$data[$field['key']] = $stored[$field['key']];
}
$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) !== '' ? '***' : '';
}