diff --git a/Backend/CommsTransmitter.cs b/Backend/CommsTransmitter.cs index 2da48895..6eab6392 100644 --- a/Backend/CommsTransmitter.cs +++ b/Backend/CommsTransmitter.cs @@ -42,7 +42,7 @@ namespace Swarmops.Backend customStrings["RecipientCount"] = comm.Recipients.Count.ToString("N0"); if (resolver is IHasGeography) { - customStrings["GeographyName"] = ((IHasGeography) resolver).Geography.Name; + customStrings["GeographyName"] = ((IHasGeography) resolver).Geography.Localized; } OutboundComm.CreateNotification(Organization.FromIdentity(comm.OrganizationId), NotificationResource.OutboundComm_Resolved, notifyStrings, customStrings, @@ -66,6 +66,8 @@ namespace Swarmops.Backend BotLog.Write(2, "CommsTx", "--transmitting to " + recipients.Count.ToString("N0") + " recipients"); comm.StartTransmission(); + int success = 0; + int fail = 0; foreach (OutboundCommRecipient recipient in recipients) { @@ -73,10 +75,12 @@ namespace Swarmops.Backend { transmitter.Transmit (envelope, recipient.Person); recipient.CloseSuccess(); + success++; } catch (OutboundCommTransmitException e) { recipient.CloseFailed (e.Description); + fail++; } } @@ -84,7 +88,7 @@ namespace Swarmops.Backend BotLog.Write(2, "CommsTx", "--closing"); - if (comm.RecipientsFail + comm.RecipientsSuccess > 1) + if (success + fail > 1) { BotLog.Write(2, "CommsTx", "--notifying"); @@ -97,13 +101,13 @@ namespace Swarmops.Backend NotificationStrings notifyStrings = new NotificationStrings(); NotificationCustomStrings customStrings = new NotificationCustomStrings(); notifyStrings[NotificationString.OrganizationName] = Organization.FromIdentity(comm.OrganizationId).Name; - customStrings["RecipientCount"] = comm.Recipients.Count.ToString("N0"); - customStrings["RecipientsSuccess"] = comm.RecipientsSuccess.ToString("N0"); + customStrings["RecipientCount"] = recipients.Count.ToString("N0"); + customStrings["RecipientsSuccess"] = success.ToString("N0"); customStrings["TransmissionTime"] = (comm.ClosedDateTime - comm.StartTransmitDateTime).ToString("m min ss.ff sec"); if (resolver is IHasGeography) { - customStrings["GeographyName"] = ((IHasGeography)resolver).Geography.Name; + customStrings["GeographyName"] = ((IHasGeography)resolver).Geography.Localized; } OutboundComm.CreateNotification(Organization.FromIdentity(comm.OrganizationId), NotificationResource.OutboundComm_Sent, notifyStrings, customStrings, diff --git a/Site/Pages/v5/Comms/SendMassMessage.aspx.cs b/Site/Pages/v5/Comms/SendMassMessage.aspx.cs index 01a2427f..7148127f 100644 --- a/Site/Pages/v5/Comms/SendMassMessage.aspx.cs +++ b/Site/Pages/v5/Comms/SendMassMessage.aspx.cs @@ -111,13 +111,10 @@ namespace Swarmops.Frontend.Pages.Comms { AuthenticationData authData = GetAuthenticationDataAndCulture(); - if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox)) + if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox) && authData.CurrentUser.Identity == 1 && !live) { - if (authData.CurrentUser.Identity == 1) - { - OutboundComm.CreateSandboxMail(subject, body, dummyMail); - return new AjaxCallResult {Success = true}; - } + OutboundComm.CreateSandboxMail(subject, body, dummyMail); + return new AjaxCallResult {Success = true}; return new AjaxCallResult {Success = false}; // wtf, this shouldn't happen }