fix: ora per l'invio delle mail considera le eventuali persone in copia nella comunicazione selezionata

This commit is contained in:
Gabriele Cimaschi
2026-07-09 13:02:04 +02:00
parent a89605b888
commit 725bdaeae4
3 changed files with 53 additions and 10 deletions
+16 -2
View File
@@ -132,12 +132,26 @@ router.get('/users', async (req, res) => {
});
// GET /api/config — Application config
router.get('/config', (req, res) => {
router.get('/config', async (req, res) => {
const agentId = parseInt(req.headers['x-agent-id'], 10) || 1;
let agentEmail = '';
try {
const prefRes = await pool.query(
`SELECT preferences_value FROM user_preferences WHERE user_id = $1 AND preferences_key = 'UserEmail'`,
[agentId]
);
if (prefRes.rows.length > 0) {
agentEmail = prefRes.rows[0].preferences_value || '';
}
} catch (_) {}
res.json({
defaultAgentLogin: process.env.OTRS_API_USER || '',
dailyTargetTime: parseInt(process.env.DAILY_TARGET_TIME, 10) || 480,
phraseThreshold: parseInt(process.env.PHRASE_THRESHOLD, 10) || 70,
autoTimeMinHour: process.env.AUTO_TIME_MIN_HOUR || '18:00'
autoTimeMinHour: process.env.AUTO_TIME_MIN_HOUR || '18:00',
helpdeskEmail: process.env.OTRS_MAIL_BCC || '',
agentEmail: agentEmail
});
});