From bbcac245abd25e96024b6adbb203cb579b46e481 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Mon, 5 Jan 2026 23:05:16 +0100 Subject: [PATCH] fix: truncate long error messages in test email display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show only first line of error for cleaner UI, full details still logged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- static/admin/js/settings.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/static/admin/js/settings.js b/static/admin/js/settings.js index f01cf059..e758880c 100644 --- a/static/admin/js/settings.js +++ b/static/admin/js/settings.js @@ -475,9 +475,11 @@ function adminSettings() { this.testEmailSuccess = null; try { + settingsLog.info('Sending test email to:', this.testEmailAddress); const data = await apiClient.post('/admin/settings/email/test', { to_email: this.testEmailAddress }); + settingsLog.info('Test email response:', data); if (data.success) { this.testEmailSuccess = `Test email sent to ${this.testEmailAddress}`; @@ -485,13 +487,20 @@ function adminSettings() { this.testEmailSuccess = null; }, 5000); } else { - this.testEmailError = data.message || 'Failed to send test email'; + settingsLog.error('Test email failed:', data.message); + // Extract the first line of error for cleaner display + let errorMsg = data.message || 'Failed to send test email'; + if (errorMsg.includes('\n')) { + errorMsg = errorMsg.split('\n')[0]; + } + this.testEmailError = errorMsg; } } catch (error) { - settingsLog.error('Failed to send test email:', error); + settingsLog.error('Failed to send test email (exception):', error); this.testEmailError = error.message || 'Failed to send test email'; } finally { this.sendingTestEmail = false; + settingsLog.info('sendingTestEmail set to false, testEmailError:', this.testEmailError); } } };