diff --git a/backend/src/services/bulkEmail.js b/backend/src/services/bulkEmail.js index ab18f17..52693c2 100644 --- a/backend/src/services/bulkEmail.js +++ b/backend/src/services/bulkEmail.js @@ -177,14 +177,6 @@ export async function previewBulkEmail(type) { subject: rendered.subject, text: rendered.text, recipientCount: doctors.length, - recipients: - type === 'reminder' - ? doctors.map((doctor) => ({ - email: doctor.email, - name: doctorGreetingName(doctor.hcp_name), - steps: doctor.steps, - })) - : [], }; } diff --git a/backend/test/bulkEmail.test.js b/backend/test/bulkEmail.test.js index 9578664..f6c12d8 100644 --- a/backend/test/bulkEmail.test.js +++ b/backend/test/bulkEmail.test.js @@ -202,41 +202,8 @@ describe('bulk study email', () => { url: '/api/admin/emails/preview?type=reminder', headers: { cookie: sessionCookie(login) }, }); - expect(preview.result.recipients).toEqual([ - { - email: 'new@example.com', - name: 'New Doctor', - steps: { - login: 'Pending', - consent: 'Pending', - agreement: 'Pending', - approval: 'Pending', - survey: 'Pending', - }, - }, - { - email: 'testdoc1@yopmail.com', - name: 'Asha Rao', - steps: { - login: 'Completed', - consent: 'Completed', - agreement: 'Completed', - approval: 'Completed', - survey: 'Pending', - }, - }, - { - email: 'amey@stratawiz.com', - name: 'Amey', - steps: { - login: 'Pending', - consent: 'Pending', - agreement: 'Pending', - approval: 'Pending', - survey: 'Pending', - }, - }, - ]); + expect(preview.result.recipientCount).toBe(3); + expect(preview.result.recipients).toBeUndefined(); const response = await server.inject({ method: 'POST', diff --git a/frontend/src/admin/SendEmailsPage.jsx b/frontend/src/admin/SendEmailsPage.jsx index ef59ecd..4f1ce85 100644 --- a/frontend/src/admin/SendEmailsPage.jsx +++ b/frontend/src/admin/SendEmailsPage.jsx @@ -1,14 +1,6 @@ import { useEffect, useRef, useState } from 'react'; import { adminApi } from './adminApi.js'; -const PROGRESS = [ - ['login', 'Login'], - ['consent', 'Consent'], - ['agreement', 'Agreement'], - ['approval', 'Approval'], - ['survey', 'Survey'], -]; - const TYPES = [ { id: 'invitation', @@ -116,7 +108,6 @@ function LetterScreen({ subject, body, onSubject, onBody, onClose }) { export default function SendEmailsPage() { const [type, setType] = useState('invitation'); const [recipientCount, setRecipientCount] = useState(null); - const [recipients, setRecipients] = useState([]); const [subject, setSubject] = useState(''); const [body, setBody] = useState(''); const [ready, setReady] = useState(false); @@ -131,7 +122,6 @@ export default function SendEmailsPage() { setReady(false); setFullScreen(false); setError(''); - setRecipients([]); adminApi(`/api/admin/emails/preview?type=${type}`) .then((data) => { @@ -139,7 +129,6 @@ export default function SendEmailsPage() { setSubject(data.subject); setBody(data.text); setRecipientCount(data.recipientCount); - setRecipients(Array.isArray(data.recipients) ? data.recipients : []); setReady(true); } }) @@ -232,27 +221,6 @@ export default function SendEmailsPage() {

{recipientCount === null ? 'Counting doctors…' : `${recipientCount} doctors`}

- {type === 'reminder' && recipients.length > 0 ? ( - - ) : null} -

- Edit the letter on the right. Only text inside {'{ }'} is replaced for each doctor. - A letter with no tokens is saved as written. -

{error ?

{error}

: null} {result ? (

diff --git a/frontend/src/admin/SendEmailsPage.test.jsx b/frontend/src/admin/SendEmailsPage.test.jsx index ed9ea46..6d7f02c 100644 --- a/frontend/src/admin/SendEmailsPage.test.jsx +++ b/frontend/src/admin/SendEmailsPage.test.jsx @@ -34,19 +34,6 @@ describe('send emails page', () => { subject: 'Reminder Email for Extended-Dose-Pack Study', text: 'Dear Dr {Name},', recipientCount: 1, - recipients: [ - { - email: 'testdoc1@yopmail.com', - name: 'Asha Rao', - steps: { - login: 'Completed', - consent: 'Pending', - agreement: 'Pending', - approval: 'Pending', - survey: 'Pending', - }, - }, - ], }), }; } @@ -92,9 +79,8 @@ describe('send emails page', () => { '/api/admin/emails/preview?type=reminder', expect.objectContaining({ method: 'GET' }), ); - expect(screen.getByText('testdoc1@yopmail.com')).toBeInTheDocument(); - expect(screen.getByText('Login — Completed')).toBeInTheDocument(); - expect(screen.getByText('Survey — Pending')).toBeInTheDocument(); + expect(screen.getByText('1 doctors')).toBeInTheDocument(); + expect(screen.queryByText('testdoc1@yopmail.com')).not.toBeInTheDocument(); fireEvent.change(screen.getByLabelText('Letter'), { target: { value: 'Hello {Name}' },