Skip to content
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

Merged
merged 16 commits into from
Nov 6, 2024

Conversation

rmohammed-goaco
Copy link
Collaborator

@rmohammed-goaco rmohammed-goaco commented Nov 1, 2024

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

@rmohammed-goaco rmohammed-goaco changed the title Feature/dp 785 resend invite DP-785 - User Management - Resend Invite Nov 1, 2024
@rmohammed-goaco rmohammed-goaco marked this pull request as ready for review November 1, 2024 15:52
private void GuardPersonInviteAleadyClaimed(PersonInvite personInvite)
private void GuardPersonInviteExpired(PersonInvite personInvite)
{
if (personInvite.ExpiresOn < DateTimeOffset.UtcNow)
Copy link
Collaborator

@maciej-goaco maciej-goaco Nov 4, 2024

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)

Copy link
Collaborator Author

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
_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()
Copy link
Member

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.

@rmohammed-goaco rmohammed-goaco merged commit 03dce02 into main Nov 6, 2024
8 checks passed
@dharmverma dharmverma deleted the feature/DP-785-resend-invite branch November 28, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants