Add Settings 'Send Test Digest Email' button (admin) (v0.1.0:75)

Surface the digest test-send endpoint as a clickable admin control so it can be
exercised on the box without curl. Calls POST /api/admin/digest/test-email and
toasts the result (or a 'configure SMTP first' hint). JSX parse-checked.
This commit is contained in:
Keysat
2026-06-15 18:55:32 -05:00
parent a350f8f5dd
commit 114a94c894
3 changed files with 29 additions and 2 deletions
+27
View File
@@ -7768,6 +7768,7 @@
const [users, setUsers] = useState([]);
const [usersLoading, setUsersLoading] = useState(false);
const [userActionLoadingId, setUserActionLoadingId] = useState(null);
const [testEmailLoading, setTestEmailLoading] = useState(false);
const [auditLogs, setAuditLogs] = useState([]);
const [auditLoading, setAuditLoading] = useState(false);
const [automationRules, setAutomationRules] = useState([]);
@@ -8216,6 +8217,22 @@
}
};
const handleSendTestDigestEmail = async () => {
setTestEmailLoading(true);
try {
const result = await api('/api/admin/digest/test-email', {
method: 'POST',
body: JSON.stringify({})
}, token);
const to = (result?.data?.sent_to || []).join(', ');
onShowToast(`Test digest email sent${to ? ` to ${to}` : ''}`, 'success');
} catch (err) {
onShowToast(getErrorMessage(err, 'Failed to send test email — is SMTP configured? (Start9: Configure Digest SMTP, then restart)'), 'error');
} finally {
setTestEmailLoading(false);
}
};
const handleContactsCsvFileUpload = async (event) => {
const file = event.target.files && event.target.files[0];
if (!file) return;
@@ -8496,6 +8513,16 @@
Invite users and manage fundraising state backups.
</div>
<div style={{ marginBottom: '20px', borderBottom: '1px solid #263548', paddingBottom: '16px' }}>
<div style={{ fontWeight: 600, marginBottom: '8px' }}>Daily Digest Email</div>
<div style={{ fontSize: '12px', color: '#8ea2b7', marginBottom: '10px' }}>
Sends a test message to all active admins through the configured SMTP account, to verify outbound email works. Configure SMTP via the Start9 "Configure Digest SMTP" action, then restart the service.
</div>
<button type="button" onClick={handleSendTestDigestEmail} disabled={testEmailLoading}>
{testEmailLoading ? <Spinner /> : 'Send Test Digest Email'}
</button>
</div>
<div style={{ marginBottom: '20px', borderBottom: '1px solid #263548', paddingBottom: '16px' }}>
<div style={{ fontWeight: 600, marginBottom: '10px' }}>Invite User</div>
<form onSubmit={handleInviteUser}>