-
Notifications
You must be signed in to change notification settings - Fork 1
Private competition improvements: member picker, inline management, admin editing #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
The invite member dialog now shows a searchable combobox of eligible users (filtered to exclude existing members) instead of a blank email field. Users display as "Name (username)" and can be filtered by typing. - Add shadcn Command component (cmdk) for searchable list UI - Add getEligibleMembers server action to fetch non-member active users - Add addCompetitionMemberById server action accepting userId directly - Rewrite InviteMemberDialog with Popover + Command combobox Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Members tab now renders the member list inline instead of linking to a separate page. All private competition members can see the tab (read-only), while admins also get the Add Member button and role/remove controls. The standalone /members page is removed. - Fetch members client-side when Members tab is active - Show Members tab to all private competition members, not just admins - Add onMemberChange callback to MembersTable and InviteMemberDialog - Remove Invite/Manage Members links from header dropdown - Delete app/competitions/[competitionId]/members/ page Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The updateCompetition server action now checks for competition admin role on private competitions, not just system admin. The dashboard header opens an inline edit dialog for private competitions instead of linking to the system admin page. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Hide the is_private toggle in edit mode so only new competitions can set visibility. Strip is_private from the update server action payload as a safeguard. Also add autoComplete="off" to the competition name input to prevent 1Password autofill. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Previously any logged-in user could call getEligibleMembers and get the full list of active non-member users, leaking the user directory. Now only competition admins and system admins can access this endpoint. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This function was replaced by addCompetitionMemberById when the invite dialog switched to a searchable user picker. No callers remain. Also removes the now-unused sql import from kysely. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
If getCompetitionMembers fails, show the error message instead of spinning indefinitely. Clears the error on each new fetch attempt. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move auth, user existence, and duplicate-member checks before the withRLS callback so they return error() directly, matching the pattern used by other server actions in this file. Removes the throw/catch string-prefix parsing approach. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The standalone /competitions/[id]/members page was removed when member management moved into the dashboard Members tab. These revalidatePath calls targeted a route that no longer exists. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
If getEligibleMembers fails, show the error message inside the command list instead of spinning indefinitely. Matches the error handling pattern used in the dashboard members tab. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace the full Competition type with a Pick of the six fields the form actually reads (id, name, is_private, and the three date fields). This removes the need for dummy created_at/updated_at/created_by_user_id values in the competition header. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract the Zod schema to its own file (competition-form-schema.ts) so it can be tested without pulling in database dependencies. Add 16 tests covering: - Name length validation - Private competitions skipping date requirements and ordering - Public competitions requiring all three dates - Date ordering constraints (open < close < end) - Edge cases (equal dates, missing subset of dates) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…petition_members table Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ed variable Move setMembersError and setEligibleUsersError calls inside startTransition callbacks to avoid synchronous setState in effect bodies. Remove unused `result` assignment in removeCompetitionMember. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Bare db queries on competition_members fail because RLS policies require app.current_user_id to be set. Switch pre-check queries to use withRLS, and add system admin bypass to addCompetitionMemberById matching the pattern in getEligibleMembers. Also fix PropertyKey[] type in test helper to match Zod's issue type. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The auth check and date validation queries used bare db without RLS context, causing "Competition not found" for system admins and "Only admins can update" for competition admins. Switch all pre-update queries to use withRLS. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
getEligibleMembers; refactoraddCompetitionMemberByIdto use early returnsCompetitiontype withEditableCompetition(Pick of 6 fields) to eliminate dummy valuesaddCompetitionMemberfunction, stalerevalidatePathcalls, unused importsautoComplete="off"to competition name inputTest plan
getEligibleMembersreturns an authorization errornpm run test— all 157 tests pass (including 16 new schema validation tests)🤖 Generated with Claude Code