fix: add language detection from app_settings and fix activity_logs schema
Mirror to GitHub / mirror (push) Successful in 26s
Test and Lint / backend-test (push) Successful in 1m6s
Test and Lint / frontend-test (push) Successful in 2m23s
Version and Release / version-bump (push) Successful in 33s
Version and Release / trigger-drone (push) Successful in 3s
continuous-integration/drone/push Build is passing

- Enhanced language detection priority in email processor:
  1. Event-specific language
  2. App settings general_default_language (NEW)
  3. Email config default_language
  4. Domain-based detection
- Fixed activity_logs insertion error by using logActivity function
- Fixed 500 error on resend email endpoint
- Emails now respect language selected in settings page
This commit is contained in:
2025-07-16 16:45:43 +02:00
parent db7e5913eb
commit a9c2761986
6 changed files with 340 additions and 13 deletions
+14 -2
View File
@@ -73,7 +73,19 @@ async function getRecipientLanguage(email, eventId = null) {
}
}
// Second priority: Check email configs for default language
// Second priority: Check app_settings for general default language
try {
const langSetting = await db('app_settings')
.where('setting_key', 'general_default_language')
.first();
if (langSetting && langSetting.setting_value) {
return langSetting.setting_value;
}
} catch (error) {
logger.error('Error fetching app settings language:', error);
}
// Third priority: Check email configs for default language
try {
const emailConfig = await db('email_configs').first();
if (emailConfig && emailConfig.default_language) {
@@ -83,7 +95,7 @@ async function getRecipientLanguage(email, eventId = null) {
logger.error('Error fetching email config language:', error);
}
// Third priority: Check if the email domain suggests German
// Fourth priority: Check if the email domain suggests German
if (email) {
const germanDomains = ['.de', '.at', '.ch', '.li'];
const domain = email.toLowerCase();