-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DP-785 - User Management - Resend Invite #884
Conversation
…te if all invites are expired.
....OrganisationInformation.Persistence/Migrations/20241030163144_AddExpiresOnToPersonInvite.cs
Show resolved
Hide resolved
private void GuardPersonInviteAleadyClaimed(PersonInvite personInvite) | ||
private void GuardPersonInviteExpired(PersonInvite personInvite) | ||
{ | ||
if (personInvite.ExpiresOn < DateTimeOffset.UtcNow) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we'd need to use UtcDateTime of ExpiresOn in this comparison to make sure we're comparing UTC times here, e.g. if (personInvite.ExpiresOn?.UtcDateTime < DateTimeOffset.UtcNow)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Thats much better. I've applied this change.
…ce/GCGS-Central-Digital-Platform into feature/DP-785-resend-invite
Services/CO.CDP.Organisation.WebApi/UseCase/InvitePersonToOrganisationUseCase.cs
Show resolved
Hide resolved
_personsInviteRepository.Verify(repo => repo.Save(It.IsAny<PersonInvite>()), Times.Once); | ||
_mockGovUKNotifyApiClient.Verify(client => client.SendEmail(It.IsAny<EmailNotificationRequest>()), Times.Once); | ||
} | ||
|
||
[Fact] | ||
public async Task Execute_ValidInviteDuplicateEmailForOrganisation_ThrowsException() | ||
public async Task Execute_ValidInviteWithSameEmailForOrganisation_ExpiresExistingInviteAndCreatesAnother() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something went wrong with indentation here.
Includes a migration to add
ExpiredOn
so looks bigger than it actually is.Adds functionality to allow the user to "Resend" an invite. A new
ExpiredOn
field has been added. This is used to expire any other unexpired person invites and create a new one. Once a person invite has expired it can no longer be claimed.The functionality has been implemented in a way that will allow us to extend it to expire a person invite after a specific time. It also takes into account that this may happen automatically in a future update (using scheduled events of some kind). At the moment the functionality is manual where an organisation admin can click a button to confirm the person invite details and send out a new one.
The person invite list has also been updated to only display the unexpired person invite, if one exists, but otherwise the last person invite that expired; so that it can resent if needs be.
https://noticingsystem.atlassian.net/browse/DP-785