Repository navigation
fix(invitations): keep every invited role through acceptance - #126
Merged
Merged
Conversation
A pending invitation stored one builtin role name, so an invite with several roles kept only the first, and a custom role could not be invited at all. pending_invitations gains role_ids. Both invite endpoints accept role_ids, each checked like assigning it: same team, Business gate for custom roles, and the inviter must cover it. Acceptance assigns every id that still exists and falls back to the builtin role name only when none does. Clients that send only `role` behave as before. The pending list returns role_ids, and `role` holds the most senior invited role for display. assign_member_role and invite share require_may_assign_role. Refs VoltiusApp/voltius#779
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server side of VoltiusApp/voltius#779.
A pending invitation stored one builtin role name. An invite with several roles kept only the first one, and an invite with a custom role failed.
Change
pending_invitations.role_ids UUID[] NOT NULL DEFAULT '{}'.POST /v1/teams/:id/membersandPOST /v1/teams/:id/inviteaccept an optionalrole_ids. Each id goes through the same check as Assign role (require_may_assign_role, now shared withassign_member_role):A request can carry at most 32 ids.
admit_memberassigns every invited id that still exists. It falls back to the builtinrolename only when none of them does, so a role deleted before acceptance is skipped.role_ids, the same way it already replacedrole.rolenow holds the most senior invited role, which invitees see in the invite preview and in their pending list. The team's pending list also returnsrole_ids.role_ids.Compatibility
roleget exactly what they get today.role(a builtin), so the invitee gets that one role.Tests (new
invite_role_testsmodule)role_idsare correct.Needs a deploy before the client change does anything; the client PR follows.