gql/inviteLinks: Remove Capability enum type reference#1981
Open
jshearer wants to merge 1 commit into
Open
Conversation
8fe1067 to
3655eea
Compare
…InviteLink` The mutation declared `$capability: Capability!`, embedding the GraphQL enum type name in the query body. An upcoming backend rename of `Capability` to `LegacyCapability` would cause this query to fail server-side parsing. Replace the typed variable with a fixed per-value mutation that inlines the capability as an enum literal. This is just temporary, as once the new authorization system is live we'll be refactoring this whole thing.
3655eea to
85fa019
Compare
GregorShear
approved these changes
May 26, 2026
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.
Summary
The
CreateInviteLinkmutation declared$capability: Capability!, embedding the GraphQL enum type name in the query string. The upcoming authz refactor renamesCapabilitytoLegacyCapability, which would cause this query to fail.This change replaces the typed variable with a fixed per-value mutation that inlines the capability as an unquoted GraphQL enum literal (e.g.
capability: admin), so the query body no longer references the enum type by name. After this lands, the backend rename can proceed without a coordinated UI deploy.Implementation
src/api/gql/inviteLinks.ts: three static mutations (one per allowed value), exported asCREATE_INVITE_LINK_BY_CAPABILITYmap. Static mutations rather than${capability}interpolation because theclientcodegen preset extracts query strings statically.isCreateInviteLinkCapabilityruntime guard prevents any value outsideadmin | read | writefrom reaching the map lookup.GenerateInvitation.tsx: selects the mutation by current capability state and dropscapabilityfrom the variables payload. ThecapabilityuseStatedeclaration moved aboveuseMutationto satisfy hook ordering.Other queries that select
userCapabilityfields and the hand-writtenCapabilitytype import inGenerateInvitation.tsxare intentionally untouched. Those are wire-format stable across the rename and only need a codegen rerun in a follow-up PR.