Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/Feature.Auth/ForgotPassword/Endpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override async Task<Results<Ok, ProblemHttpResult>> ExecuteAsync(Request
? await GetResetPasswordEmail(user)
: GetAcceptInviteEmail(user);

jobService.EnqueueSendEmail(request.Email, mail.Subject, mail.Body);
jobService.EnqueueSendEmail(request.Email, mail.Subject, mail.Body, mail.TextBody);

return TypedResults.Ok();
}
Expand Down
2 changes: 1 addition & 1 deletion api/src/Feature.CitizenReports/SendCopy/Endpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override async Task<NoContent> ExecuteAsync(Request req,
$"Citizen report #{req.CitizenReportId}",
MapAnswersToEmailFragmentProps(form, citizenReport), _apiConfiguration.WebAppUrl));

jobService.EnqueueSendEmail(req.Email, email.Subject, email.Body);
jobService.EnqueueSendEmail(req.Email, email.Subject, email.Body, email.TextBody);


return TypedResults.NoContent();
Expand Down
2 changes: 1 addition & 1 deletion api/src/Feature.MonitoringObservers/Assign/Endpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override async Task<Results<Ok<Response>, NotFound<string>, Conflict<Prob
ElectionRoundDetails: electionRound.Title);

var email = emailFactory.GenerateInvitationExistingUserEmail(invitationExistingUserEmailProps);
jobService.EnqueueSendEmail(observer.ApplicationUser.Email!, email.Subject, email.Body);
jobService.EnqueueSendEmail(observer.ApplicationUser.Email!, email.Subject, email.Body, email.TextBody);

return TypedResults.Ok(new Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override async Task<Results<NoContent, NotFound>> ExecuteAsync(Request re
ElectionRoundDetails: electionRoundName);

var email = emailFactory.GenerateNewUserInvitationEmail(invitationNewUserEmailProps);
jobService.EnqueueSendEmail(monitoringObserver.Email!, email.Subject, email.Body);
jobService.EnqueueSendEmail(monitoringObserver.Email!, email.Subject, email.Body, email.TextBody);
}

return TypedResults.NoContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public async Task ImportAsync(Guid electionRoundId, Guid ngoId,

var email = GenerateCreateAccountEmail(existingAccount.InvitationToken!, fullName, ngoName,
electionRoundName);
jobService.EnqueueSendEmail(observer.Email, email.Subject, email.Body);
jobService.EnqueueSendEmail(observer.Email, email.Subject, email.Body, email.TextBody);
}
else
{
Expand All @@ -124,7 +124,7 @@ public async Task ImportAsync(Guid electionRoundId, Guid ngoId,
existingObserver.ApplicationUser.DisplayName, ngoName, electionRoundName)
: GenerateNotificationEmail(fullName, ngoName, electionRoundName);

jobService.EnqueueSendEmail(observer.Email, email.Subject, email.Body);
jobService.EnqueueSendEmail(observer.Email, email.Subject, email.Body, email.TextBody);
}
}
else
Expand All @@ -147,7 +147,7 @@ public async Task ImportAsync(Guid electionRoundId, Guid ngoId,
await context.MonitoringObservers.AddAsync(newMonitoringObserver, ct);

var email = GenerateCreateAccountEmail(user.InvitationToken!, fullName, ngoName, electionRoundName);
jobService.EnqueueSendEmail(observer.Email, email.Subject, email.Body);
jobService.EnqueueSendEmail(observer.Email, email.Subject, email.Body, email.TextBody);
}
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/Job.Contracts/IJobService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public interface IJobService
{
void EnqueueSendEmail(string to, string subject, string body);
void EnqueueSendEmail(string to, string subject, string body, string textBody);
void EnqueueExportFormSubmissions(Guid electionRoundId, Guid ngoId, Guid exportedDataId);
void EnqueueExportQuickReports(Guid electionRoundId, Guid ngoId, Guid exportedDataId);
void EnqueueExportPollingStations(Guid electionRoundId, Guid exportedDataId);
Expand Down
4 changes: 4 additions & 0 deletions api/src/Job.Contracts/Jobs/ISendEmailJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

public interface ISendEmailJob
{
/// <summary>HTML only. Kept for jobs enqueued before the plain-text alternative.</summary>
Task SendAsync(string to, string subject, string body);

/// <summary>HTML with its plain-text alternative.</summary>
Task SendAsync(string to, string subject, string body, string textBody);
}
4 changes: 2 additions & 2 deletions api/src/Vote.Monitor.Api/Hangfire/HangfireJobService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Vote.Monitor.Api.Hangfire;

public class HangfireJobService(IBackgroundJobClient backgroundJobClient) : IJobService
{
public void EnqueueSendEmail(string to, string subject, string body)
public void EnqueueSendEmail(string to, string subject, string body, string textBody)
{
backgroundJobClient.Enqueue<ISendEmailJob>(job => job.SendAsync(to, subject, body));
backgroundJobClient.Enqueue<ISendEmailJob>(job => job.SendAsync(to, subject, body, textBody));
}

public void EnqueueExportFormSubmissions(Guid electionRoundId, Guid ngoId, Guid exportedDataId)
Expand Down
2 changes: 1 addition & 1 deletion api/src/Vote.Monitor.Api/Hangfire/NoopJobService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Vote.Monitor.Api.Hangfire;

internal class NoopJobService : IJobService
{
public void EnqueueSendEmail(string to, string subject, string body)
public void EnqueueSendEmail(string to, string subject, string body, string textBody)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

~$listTitle$~
~$attachments$~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

~$listTitle$~
~$notes$~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~$linkText$~: ~$link$~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
~$text$~
~$answer$~
~$notes$~~$attachments$~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~$number$~ ~$text$~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
~$text$~
~$options$~
~$notes$~~$attachments$~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
( ~$value$~ )
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ ~$value$~ ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
~$text$~
~$options$~~$notes$~~$attachments$~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ ] ~$text$~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[x] ~$text$~
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/><style>@media(min-width:640px){.sm_my-40px{margin-top:40px!important;margin-bottom:40px!important}.sm_w-64{width:16rem!important}.sm_p-20px{padding:20px!important}.sm_px-10{padding-left:2.5rem!important;padding-right:2.5rem!important}.sm_px-12{padding-left:3rem!important;padding-right:3rem!important}.sm_pb-12{padding-bottom:3rem!important}.sm_pt-14{padding-top:3.5rem!important}}</style></head><div style="display:none;overflow:hidden;line-height:1px;opacity:0;max-height:0;max-width:0">~$preview$~<div> ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏</div></div><body style="padding-left:0.5rem;padding-right:0.5rem;margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, &quot;Noto Sans&quot;, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;;background-color:rgb(255,255,255)"><table align="center" width="100%" class="sm_my-40px sm_p-20px" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:640px;margin-top:20px;margin-bottom:20px;margin-left:auto;margin-right:auto;padding:10px"><tbody><tr style="width:100%"><td><table align="center" width="100%" class="sm_pb-12 sm_px-10 sm_pt-14" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="display:flex;padding-left:1.5rem;padding-right:1.5rem;padding-top:2rem;padding-bottom:2rem;background-color:rgb(107,33,168)"><tbody><tr><td><img class="sm_w-64" src="~$cdnUrl$~/logo.png" style="display:block;outline:none;border:none;text-decoration:none;width:12rem"/></td></tr></tbody></table><table align="center" width="100%" class="sm_px-12 sm_pt-14" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="padding-left:1.5rem;padding-right:1.5rem;padding-top:2rem;padding-bottom:2rem"><tbody><tr><td><h2>~$heading$~</h2>~$answers$~</td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea"/><p style="font-size:0.875rem;line-height:1.25rem;margin:16px 0;color:rgb(107,114,128)">© <!-- -->2024<!-- --> Commit Global. All rights reserved.</p></td></tr></tbody></table></body></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/><style>@media(min-width:640px){.sm_my-40px{margin-top:40px!important;margin-bottom:40px!important}.sm_w-64{width:16rem!important}.sm_p-20px{padding:20px!important}.sm_px-10{padding-left:2.5rem!important;padding-right:2.5rem!important}.sm_px-12{padding-left:3rem!important;padding-right:3rem!important}.sm_pb-12{padding-bottom:3rem!important}.sm_pt-14{padding-top:3.5rem!important}}</style></head><div style="display:none;overflow:hidden;line-height:1px;opacity:0;max-height:0;max-width:0">~$preview$~<div> ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏ ‌​‍‎‏</div></div><body style="padding-left:0.5rem;padding-right:0.5rem;margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, &quot;Helvetica Neue&quot;, Arial, &quot;Noto Sans&quot;, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;, &quot;Noto Color Emoji&quot;;background-color:rgb(255,255,255)"><table align="center" width="100%" class="sm_my-40px sm_p-20px" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:640px;margin-top:20px;margin-bottom:20px;margin-left:auto;margin-right:auto;padding:10px"><tbody><tr style="width:100%"><td><table align="center" width="100%" class="sm_pb-12 sm_px-10 sm_pt-14" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="display:flex;padding-left:1.5rem;padding-right:1.5rem;padding-top:2rem;padding-bottom:2rem;background-color:rgb(107,33,168)"><tbody><tr><td><img class="sm_w-64" src="~$cdnUrl$~/logo.png" style="display:block;outline:none;border:none;text-decoration:none;width:12rem"/></td></tr></tbody></table><table align="center" width="100%" class="sm_px-12 sm_pt-14" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="padding-left:1.5rem;padding-right:1.5rem;padding-top:2rem;padding-bottom:2rem"><tbody><tr><td><h2>~$heading$~</h2>~$answers$~</td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea"/><p style="font-size:0.875rem;line-height:1.25rem;margin:16px 0;color:rgb(107,114,128)">© ~$year$~ Commit Global. All rights reserved.</p></td></tr></tbody></table></body></html>
3 changes: 3 additions & 0 deletions api/src/Vote.Monitor.Core/EmailTemplates/citizen-report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
~$heading$~

~$answers$~© ~$year$~ Commit Global. All rights reserved.
Loading
Loading