Skip to content

[PM-38749] Add endpoint to update SupportsConfirmation and inviteBlob#7999

Draft
JimmyVo16 wants to merge 2 commits into
mainfrom
ac/pm-38749/add-supports-confirmation-endpoint
Draft

[PM-38749] Add endpoint to update SupportsConfirmation and inviteBlob#7999
JimmyVo16 wants to merge 2 commits into
mainfrom
ac/pm-38749/add-supports-confirmation-endpoint

Conversation

@JimmyVo16

@JimmyVo16 JimmyVo16 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-38749

📔 Objective

  1. Add an endpoint to update the invite and supportsConfirmation to enable or disable the confirmation flow for the invite link.
  2. Add tests.

@JimmyVo16 JimmyVo16 self-assigned this Jul 16, 2026
@JimmyVo16 JimmyVo16 added ai-review Request a Claude code review t:feature Change Type - Feature Development labels Jul 16, 2026
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the new support-confirm endpoint that updates an organization invite link's Invite blob and SupportsConfirmation flag, along with its command, request models, DI registration, and unit/integration tests. The implementation follows the established invite-link command patterns closely: ability check, existence check, TryAddScoped DI, TimeProvider-based revision date, and EncryptedStringLength(3000) validation consistent with the sibling Create/Refresh/Update models. Test coverage is thorough (success, not-found, not-available, null-ability, and only-changed-fields verification).

Code Review Details
  • ❓ : Mutating command does not log an organization audit event, unlike every sibling invite-link command (Create/Update-domains/Refresh each call LogOrganizationEventAsync).
    • src/Core/AdminConsole/OrganizationFeatures/InviteLinks/UpdateInviteSupportConfirmCommand.cs:21 — already raised in an existing review thread; not re-posted here.

TypedResults.Ok(new OrganizationInviteLinkResponseModel(link)));
}

[HttpPut("support-confirm")]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly about this route name. We have an endpoint with the base route that only updates the domain name, so we need to name this one something different. I'm happy to hear any suggestions.

Comment on lines +21 to +40
}

var inviteLink = await organizationInviteLinkRepository.GetByOrganizationIdAsync(request.OrganizationId);
if (inviteLink is null)
{
return new InviteLinkNotFound();
}

inviteLink.Invite = request.Invite;
inviteLink.SupportsConfirmation = request.SupportsConfirmation;
inviteLink.RevisionDate = timeProvider.GetUtcNow().UtcDateTime;

await organizationInviteLinkRepository.ReplaceAsync(inviteLink);

return inviteLink;
}

private async Task<bool> OrganizationHasInviteLinksAbilityAsync(Guid organizationId)
{
var ability = await organizationAbilityCacheService.GetOrganizationAbilityAsync(organizationId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUESTION: This mutating command does not log an organization audit event, unlike every sibling invite-link command.

Details

CreateOrganizationInviteLinkCommand, UpdateOrganizationInviteLinkCommand (Organization_InviteLinkDomainsEdited), RefreshOrganizationInviteLinkCommand, and DeleteOrganizationInviteLinkCommand all inject IEventService and log an EventType.Organization_InviteLink* event on success. This command changes the Invite blob and SupportsConfirmation flag but records nothing in the audit trail.

Is the missing audit event intentional (e.g., deferred to a follow-up, or intentionally out of scope), or should a new EventType be logged here for consistency with the other mutating operations?

.UpdateAsync(Arg.Is<UpdateInviteSupportConfirmRequest>(r =>
r.OrganizationId == orgId &&
r.Invite == "new-invite-blob" &&
r.SupportsConfirmation == true));
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 62.24%. Comparing base (3e79593) to head (75bb09c).

Files with missing lines Patch % Lines
...s/InviteLinks/UpdateInviteSupportConfirmRequest.cs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7999      +/-   ##
==========================================
+ Coverage   62.23%   62.24%   +0.01%     
==========================================
  Files        2287     2290       +3     
  Lines       99663    99705      +42     
  Branches     9004     9007       +3     
==========================================
+ Hits        62023    62064      +41     
- Misses      35469    35470       +1     
  Partials     2171     2171              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant