Skip to content

feat: Invite a contributor as a member (pitch #3806, scope D)#3825

Merged
Anty0 merged 1 commit into
jirikuchynka/community-contributorsfrom
jirikuchynka/invite-contributor
Jul 25, 2026
Merged

feat: Invite a contributor as a member (pitch #3806, scope D)#3825
Anty0 merged 1 commit into
jirikuchynka/community-contributorsfrom
jirikuchynka/invite-contributor

Conversation

@Anty0

@Anty0 Anty0 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Part of pitch #3806 (Community translation v1.1 — Contributors), scope D. Targets the integration branch (PR #3819), not main.

What

Adds an "Invite as member" button to a Community-tab row on the project Members page. Clicking it invites that contributor to the project by user id — the server resolves their address, sends the invitation mail, and never returns it to the org.

  • New endpoint PUT /v2/projects/{projectId}/invite-contributor (MEMBERS_EDIT); the body carries userId + permission fields, no email.
  • Email-free by construction. The address is stored server-side (needed to send the mail and bind acceptance) but is masked at read time by Invitation.visibleEmail — the single home of the rule — which every assembler that serializes an invitee address reads (Team-tab pending list and the unauthenticated invitation_info endpoint). Pitch hard-constraint 1: no contributor email reaches the org before acceptance.
  • Anti-oracle guard. Only visible contributors of the project may be invited (reusing the Community tab's member / deleted / disabled exclusions, via a single shared VISIBLE_CONTRIBUTOR query). Every other id — nonexistent, deleted, disabled, member, org member, or a contributor of another project — returns one byte-identical 404, so the endpoint leaks neither account existence nor state.
  • No permission-less membership. type = NONE is rejected server-side (CANNOT_INVITE_CONTRIBUTOR_WITH_NO_PERMISSION), not merely hidden in the picker.
  • Scoped/advanced invites route through the EE service exactly like the email invite; agencyId stays null (a non-null agency would short-circuit acceptance binding).
  • Acceptance is bound to the invitee (email = user.username); a different user gets INVITATION_EMAIL_MISMATCH.

Frontend

  • members.edit-gated "Invite as member" button on the contributor row, opening the existing PermissionsModal picker with hideNone (matching the email dialog). The permission→body mapping is factored into a shared helper used by both invite hooks.

Tests

  • Backend (InviteContributorControllerTest, InviteContributorEeTest): email stored + hidden, model + public-endpoint email null, MEMBERS_EDIT gate, uniform-404 for every non-visible-contributor id, re-invite dedup, NONE rejection, EE scoped routing + granted languages, nameless-contributor path, acceptance binding + granted membership.
  • Frontend: vitest over the shared permission-body helper (all role/scope/language branches, incl. scope-based filtering); an E2E case that invites a contributor from the Community tab (typed data-cy selectors), asserts the request succeeds, that a pending invitation appears, and that the NONE role is absent from the picker.

Notes

  • Accepted, documented limitations (see the plan's Risks): an already-invited contributor stays listed with a live button until they accept (a second click fails safely with a no-email error), and acceptance is email-bound rather than user-FK-bound (a full user-FK model is deferred to a follow-up across all invitation kinds).

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e7e9cbac-8ec4-4f7a-8b1a-0997e54d5b56

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jirikuchynka/invite-contributor

Comment @coderabbitai help to get the list of available commands.

@Anty0
Anty0 force-pushed the jirikuchynka/community-contributors branch from 34b9f46 to 70a1fe0 Compare July 25, 2026 14:29
@Anty0
Anty0 force-pushed the jirikuchynka/invite-contributor branch from 67f5f35 to 84c61e1 Compare July 25, 2026 14:51
@Anty0
Anty0 force-pushed the jirikuchynka/community-contributors branch from 70a1fe0 to 37ab36d Compare July 25, 2026 15:58
@Anty0
Anty0 force-pushed the jirikuchynka/invite-contributor branch from 84c61e1 to fc107fc Compare July 25, 2026 17:01
@Anty0
Anty0 force-pushed the jirikuchynka/invite-contributor branch from fc107fc to 2956471 Compare July 25, 2026 17:33
@Anty0
Anty0 merged commit 39b8ada into jirikuchynka/community-contributors Jul 25, 2026
105 of 110 checks passed
@Anty0
Anty0 deleted the jirikuchynka/invite-contributor branch July 25, 2026 23:09
Anty0 added a commit that referenced this pull request Jul 26, 2026
Part of pitch #3806 (Community translation v1.1 — Contributors), **scope
D**. Targets the integration branch (PR #3819), not `main`.

## What

Adds an **"Invite as member"** button to a Community-tab row on the
project Members page. Clicking it invites that contributor to the
project **by user id** — the server resolves their address, sends the
invitation mail, and never returns it to the org.

- New endpoint `PUT /v2/projects/{projectId}/invite-contributor`
(`MEMBERS_EDIT`); the body carries `userId` + permission fields, **no
email**.
- **Email-free by construction.** The address is stored server-side
(needed to send the mail and bind acceptance) but is masked at read time
by `Invitation.visibleEmail` — the single home of the rule — which
**every** assembler that serializes an invitee address reads (Team-tab
pending list *and* the unauthenticated `invitation_info` endpoint).
Pitch hard-constraint 1: no contributor email reaches the org before
acceptance.
- **Anti-oracle guard.** Only *visible contributors* of the project may
be invited (reusing the Community tab's member / deleted / disabled
exclusions, via a single shared `VISIBLE_CONTRIBUTOR` query). Every
other id — nonexistent, deleted, disabled, member, org member, or a
contributor of another project — returns one **byte-identical 404**, so
the endpoint leaks neither account existence nor state.
- **No permission-less membership.** `type = NONE` is rejected
server-side (`CANNOT_INVITE_CONTRIBUTOR_WITH_NO_PERMISSION`), not merely
hidden in the picker.
- Scoped/advanced invites route through the EE service exactly like the
email invite; `agencyId` stays null (a non-null agency would
short-circuit acceptance binding).
- Acceptance is bound to the invitee (`email = user.username`); a
different user gets `INVITATION_EMAIL_MISMATCH`.

## Frontend

- `members.edit`-gated **"Invite as member"** button on the contributor
row, opening the existing `PermissionsModal` picker with `hideNone`
(matching the email dialog). The permission→body mapping is factored
into a shared helper used by both invite hooks.

## Tests

- Backend (`InviteContributorControllerTest`,
`InviteContributorEeTest`): email stored + hidden, model +
public-endpoint email null, `MEMBERS_EDIT` gate, uniform-404 for every
non-visible-contributor id, re-invite dedup, NONE rejection, EE scoped
routing + granted languages, nameless-contributor path, acceptance
binding + granted membership.
- Frontend: vitest over the shared permission-body helper (all
role/scope/language branches, incl. scope-based filtering); an E2E case
that invites a contributor from the Community tab (typed `data-cy`
selectors), asserts the request succeeds, that a pending invitation
appears, and that the `NONE` role is absent from the picker.

## Notes

- Accepted, documented limitations (see the plan's Risks): an
already-invited contributor stays listed with a live button until they
accept (a second click fails safely with a no-email error), and
acceptance is email-bound rather than user-FK-bound (a full user-FK
model is deferred to a follow-up across all invitation kinds).
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.

1 participant