Skip to content

Commit

Permalink
Fix for null reference on canceling admin invite. (#150)
Browse files Browse the repository at this point in the history
* Fixing null reference.

* formatting fix
  • Loading branch information
jrmccannon authored Oct 23, 2023
1 parent 7d9e2b7 commit 269b6c7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/AdminConsole/Pages/Organization/Admins.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,19 @@ public async Task<IActionResult> OnPostInvite(InviteForm form)

public async Task<IActionResult> OnPostCancel(string hashedCode)
{
Invites = await _invitationService.GetInvitesAsync(User.GetOrgId().Value);

var inviteToCancel = Invites.FirstOrDefault(x => x.HashedCode == hashedCode);

await _invitationService.CancelInviteAsync(hashedCode);

var performedBy = await _dataService.GetUserAsync();

var invitationCancelled = Invites.FirstOrDefault(x => x.HashedCode == hashedCode);
if (invitationCancelled is not null)
if (inviteToCancel is not null)
{
_eventLogger.LogCancelAdminInviteEvent(
performedBy,
invitationCancelled.ToEmail,
inviteToCancel.ToEmail,
_systemClock.UtcNow.UtcDateTime
);
}
Expand Down

0 comments on commit 269b6c7

Please sign in to comment.