diff --git a/packages/backend/src/Controllers/Election/sendEmailController.ts b/packages/backend/src/Controllers/Election/sendEmailController.ts index f105bf6b..62a44e78 100644 --- a/packages/backend/src/Controllers/Election/sendEmailController.ts +++ b/packages/backend/src/Controllers/Election/sendEmailController.ts @@ -24,7 +24,6 @@ const SendEmailEventQueue = "sendEmailEvent"; export type email_request_data = { voter_id?: string, email: { - template: 'invite' | 'blank' | 'receipt', subject: string, body: string, } @@ -37,7 +36,6 @@ export type email_request_event = { url: string, electionRoll: ElectionRoll, email: { - template: 'invite' | 'blank' | 'receipt', subject: string, body: string, }, @@ -61,10 +59,6 @@ const sendEmailsController = async (req: IElectionRequest, res: Response, next: throw new BadRequest(msg) } - if (email_request.email.template === 'receipt') { - throw new InternalServerError('Receipts not yet supported'); - } - let message_id = '' if (email_request.target == 'single') { diff --git a/packages/backend/src/Services/Email/EmailTemplates.ts b/packages/backend/src/Services/Email/EmailTemplates.ts index 01442df7..c8532758 100644 --- a/packages/backend/src/Services/Email/EmailTemplates.ts +++ b/packages/backend/src/Services/Email/EmailTemplates.ts @@ -59,8 +59,8 @@ export function makeEmails(election: Election, voters: ElectionRoll[], url: stri ...emailSettings, to: voter.email, // Change to your recipient from: process.env.FROM_EMAIL_ADDRESS ?? '', - subject: email_subject ?? `Invitation to Vote In ${election.title}`, - text: `${election.state === 'draft' ? `[⚠️Test ${election.settings.term_type}]` : ''} ${email_body ?? '' } You have been invited to vote in ${election.title} ${url}/${election.election_id}`, + subject: email_subject, + text: `${election.state === 'draft' ? `[⚠️Test ${election.settings.term_type}]` : ''} You have received a message from election ${election.title}`, html: emailTemplate(` ${election.state === 'draft' ? `

⚠️This ${election.settings.term_type} is still in test mode. All ballots during test mode will be removed once the election is finalized, and at that time you will need to vote again.⚠️

` : ''} ${processEmailBody(email_body, voter.voter_id)} diff --git a/packages/frontend/src/components/Election/Admin/SendEmailDialog.tsx b/packages/frontend/src/components/Election/Admin/SendEmailDialog.tsx index 742aa8cc..a29be361 100644 --- a/packages/frontend/src/components/Election/Admin/SendEmailDialog.tsx +++ b/packages/frontend/src/components/Election/Admin/SendEmailDialog.tsx @@ -6,8 +6,6 @@ import useElection from "~/components/ElectionContextProvider"; import { StyledButton } from "~/components/styles"; import { LabelledTextField, RowButtonWithArrow } from "~/components/util"; -const formatTime = (time: string | Date, tz: string) => DateTime.fromJSDate(new Date(time)).setZone(tz).toLocaleString(DateTime.DATETIME_FULL); - export default ({open, onClose, onSubmit, targetedEmail=undefined}) => { const authSession = useAuthSession() const [audience, setAudience] = useState(targetedEmail? 'single' : 'all') @@ -75,7 +73,7 @@ export default ({open, onClose, onSubmit, targetedEmail=undefined}) => { {/*minWidth keeps text from wrapping during the transition*/} Which template would you like to start with? - {['invite', 'receipt', 'blank'].map((v, i) => + {['invite', /*'receipt', */'blank'].map((v, i) => { onClick={() => { setTemplateChosen(false) onSubmit( - 'invite', // temporary emailSubject, emailBody, audience, diff --git a/packages/frontend/src/components/Election/Admin/ViewElectionRolls.tsx b/packages/frontend/src/components/Election/Admin/ViewElectionRolls.tsx index db9c2a23..ca418697 100644 --- a/packages/frontend/src/components/Election/Admin/ViewElectionRolls.tsx +++ b/packages/frontend/src/components/Election/Admin/ViewElectionRolls.tsx @@ -48,7 +48,6 @@ const ViewElectionRolls = () => { }, [location.search]) const onSendEmails = ( - template: 'invite' | 'receipt' | 'blank', subject: string, body: string, target: 'all' | 'has_voted' | 'has_not_voted' | 'single', @@ -56,7 +55,7 @@ const ViewElectionRolls = () => { setDialogOpen(false); sendEmails.makeRequest({ target: target, - email: { template, subject, body }, + email: { subject, body }, }) } @@ -67,7 +66,7 @@ const ViewElectionRolls = () => { } let headKeys:HeadKey[] = (election.settings.invitation === 'email')? - ['voter_id', 'email', 'invite_status', 'has_voted'] + ['voter_id', 'email', /*'invite_status', */'has_voted'] : ['voter_id', 'email', 'has_voted']; diff --git a/packages/frontend/src/i18n/en.yaml b/packages/frontend/src/i18n/en.yaml index 9c99d83d..06e5de0d 100644 --- a/packages/frontend/src/i18n/en.yaml +++ b/packages/frontend/src/i18n/en.yaml @@ -857,8 +857,8 @@ voters: # Email Templates emails: - voting_begin: Voting will begin on {datetime, datetime} - voting_end: '**Voting ends on {datetime, datetime}**' + voting_begin: Voting will begin on {{datetime, datetime}} + voting_end: '**Voting ends on {{datetime, datetime}}**' election_description: '{{capital_election}} {{description}}' invite: subject: Invitation to vote in {{title}} @@ -870,6 +870,9 @@ emails: __VOTE_BUTTON__ This link is unique to you, be careful not to share this email with others + blank: + subject: An update from {{title}} + body: __ELECTION_HOME_BUTTON__ # Ballots