Commit 4ee5d5d3 authored by Kimiya Beheshti 's avatar Kimiya Beheshti
Browse files

Update: solve the problem of showing deplications in email lists (coscine/issues#1531)

parent 212b0bcd
......@@ -657,6 +657,20 @@ namespace Coscine.Api.Project.Controllers
return BadRequest("This invitee already has a valid invitation to this project.");
}
var expiredInvitations = _invitationModel.GetAllWhere(
x => x.Project == sendInvitationObject.Project &&
x.InviteeEmail == sendInvitationObject.Email &&
x.Expiration <= DateTime.UtcNow
);
if (expiredInvitations != null && expiredInvitations.Any())
{
foreach (var expiredInvitation in expiredInvitations)
{
_invitationModel.Delete(expiredInvitation);
}
}
var token = _invitationModel.CreateInvitation(sendInvitationObject.Project, user.Id, sendInvitationObject.Role, sendInvitationObject.Email);
var body = new JObject
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment