More on Mass Message, short of recipient resolution

This commit is contained in:
Rick Falkvinge
2017-01-02 13:38:55 +01:00
parent 2ac3147629
commit 89342d8802
2 changed files with 38 additions and 2 deletions
+14
View File
@@ -1195,5 +1195,19 @@ namespace Swarmops.Logic.Swarm
public const int OpenLedgersIdentity = -1;
public Participation ParticipationOf(Organization organization)
{
Participations participations = GetMemberships();
foreach (Participation participation in participations)
{
if (participation.OrganizationId == organization.Identity)
{
return participation;
}
}
throw new InvalidOperationException("No valid participation for requested organization");
}
}
}
+24 -2
View File
@@ -108,9 +108,31 @@ namespace Swarmops.Frontend.Pages.Comms
public static AjaxCallResult ExecuteSend(int recipientTypeId, int geographyId, string mode, string subject,
string body, string dummyMail, bool live)
{
OutboundComm.CreateSandboxMail(subject, body, dummyMail);
AuthenticationData authData = GetAuthenticationDataAndCulture();
return new AjaxCallResult {Success = false};
if (PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
{
if (authData.CurrentUser.Identity == 1)
{
OutboundComm.CreateSandboxMail(subject, body, dummyMail);
return new AjaxCallResult {Success = true};
}
return new AjaxCallResult {Success = false}; // wtf, this shouldn't happen
}
else if (!live)
{
// Test mail
OutboundComm.CreateParticipantMail(subject, body,
authData.CurrentUser.ParticipationOf(authData.CurrentOrganization), authData.CurrentUser);
return new AjaxCallResult {Success = true};
}
else // Send live
{
throw new NotImplementedException(); // TODO: Write resolver
}
}
public struct ConfirmPayoutResult