diff --git a/NotificationSystem/SendModeratorEmail.cs b/NotificationSystem/SendModeratorEmail.cs index 986304fe..d58cdee6 100644 --- a/NotificationSystem/SendModeratorEmail.cs +++ b/NotificationSystem/SendModeratorEmail.cs @@ -35,6 +35,7 @@ public static async Task Run( var newDocumentCreated = false; DateTime? documentTimeStamp = null; + string location = null; foreach (var document in input) { @@ -42,6 +43,7 @@ public static async Task Run( { newDocumentCreated = true; documentTimeStamp = document.GetPropertyValue("timestamp"); + location = document.GetPropertyValue("location.name"); break; } } @@ -53,13 +55,14 @@ public static async Task Run( } // TODO: make better email - string body = EmailTemplate.GetModeratorEmailBody(documentTimeStamp); + string body = EmailTemplate.GetModeratorEmailBody(documentTimeStamp, location); log.LogInformation("Retrieving email list and sending notifications"); foreach (var emailEntity in EmailHelpers.GetEmailEntities(cloudTable, "Moderator")) { + string emailSubject = string.Format("OrcaHello Candidate at location {0}", location); var email = EmailHelpers.CreateEmail(Environment.GetEnvironmentVariable("SenderEmail"), - emailEntity.Email, "Please validate new OrcaHello detection", body); + emailEntity.Email, emailSubject, body); await messageCollector.AddAsync(email); } } diff --git a/NotificationSystem/SendSubscriberEmail.cs b/NotificationSystem/SendSubscriberEmail.cs index 0a8bf88e..eae3201b 100644 --- a/NotificationSystem/SendSubscriberEmail.cs +++ b/NotificationSystem/SendSubscriberEmail.cs @@ -64,7 +64,7 @@ public static async Task CreateBody(CloudQueue cloudQueue) await cloudQueue.DeleteMessageAsync(message); } - return EmailTemplate.GeSubscriberEmailBody(messagesJson); + return EmailTemplate.GetSubscriberEmailBody(messagesJson); } } } diff --git a/NotificationSystem/Template/EmailTemplate.cs b/NotificationSystem/Template/EmailTemplate.cs index 884645d6..0886f42e 100644 --- a/NotificationSystem/Template/EmailTemplate.cs +++ b/NotificationSystem/Template/EmailTemplate.cs @@ -8,12 +8,12 @@ namespace NotificationSystem.Template // TODO: we should move all html out of code and maybe use a preset email template for better design. public static class EmailTemplate { - public static string GetModeratorEmailBody(DateTime? timestamp) + public static string GetModeratorEmailBody(DateTime? timestamp, string location) { - return $"{GetModeratorEmailHtml(timestamp)}"; + return $"{GetModeratorEmailHtml(timestamp, location)}"; } - public static string GeSubscriberEmailBody(List messages) + public static string GetSubscriberEmailBody(List messages) { return $"{GetSubscriberEmailHtml(messages)}"; } @@ -26,7 +26,7 @@ private static string GetSubscriberEmailHtml(List messages)

- Southern Resident Killer Whale Spotted + Southern Resident Killer Whale Detected

Dear subscriber, a Southern Resident Killer Whale was most recently detected at around {timeString} PDT. @@ -47,7 +47,7 @@ Please be mindful of their presence when travelling in the areas below.

- In partnership with Microsoft AI 4 Earth, Orca Sound and Orca Conservancy. + In partnership with Microsoft AI 4 Earth, Orcasound and Orca Conservancy.
"; @@ -101,7 +101,7 @@ private static string GetMapUri(string locationName) } } - private static string GetModeratorEmailHtml(DateTime? timestamp) + private static string GetModeratorEmailHtml(DateTime? timestamp, string location) { string timeString = GetPDTTimestring(timestamp); @@ -109,13 +109,13 @@ private static string GetModeratorEmailHtml(DateTime? timestamp)

- Orca Call Identified + Orca Call Candidate

- Dear moderator, a potential Southern Resident Killer Whale call was detected on {timeString} PDT. + Dear moderator, a potential Southern Resident Killer Whale call was detected on {timeString} PDT at {location} location.

- This is a request for your moderation to confirm whether the sound belongs to a Southern Resident Killer Whale on the portal below. + This is a request for your moderation to confirm whether the sound was produced by Southern Resident Killer Whale on the portal below.


@@ -131,7 +131,7 @@ Go to portal