feat(maintainer/contributors): add invite system — DB schema, send invite action, accept flow #517#614
Open
prasiddhi-105 wants to merge 2 commits into
Open
Conversation
Collaborator
|
please fix the conflict, then we proceed with the review |
Contributor
|
@prasiddhi-105 is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
donee |
Collaborator
|
CI is still failing, please run |
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
This PR replaces the unstructured client-side referral link mechanism (
/?ref={accountLogin}) with a robust, database-tracked, email-driven structured invitation system. It introduces a complete backend management flow (send, resend, list, revoke) along with a standalone invitation landing accept page and a reactive "Pending Invites" sidebar tracking dashboard widget.Type of Change
Related Issue
Closes #517
What was changed?
invitestable tracking unique tokens, timestamps, target organization installation IDs, and statuses per invited email using Drizzle ORM dialects (src/lib/db/schema.ts).requireMaintainer()that securely manage invitations utilizing the project's nativegetDb()client instance (src/app/actions/maintainer/invites.ts):sendInvite(): Validates input email formatting, checks for pre-existing active records, generates a secure random hex token, writes to the DB, and dispatches the email invitation hook.resendInvite(): Renews an invitation by pushing the rolling expiration boundary out by another 7 days.listPendingInvites(): Filters and fetches active, non-expired invitation rows for the given repository workspace.revokeInvite(): Purges an active record from database indices cleanly.sendInviteEmail) wrapping the initializedresendclient package (src/lib/email.ts).src/app/invite/[token]/page.tsxas a separate, distraction-free screen outside the core dashboard shell layout. It evaluates the valid parameters, handles authentication redirection parameters cleanly via?next=, processes multi-table records atomically inside a Drizzle.transaction(), and updates the contributor access list safely.src/app/(app)/maintainer/invite-contributor-button.tsxto handle true form submission dispatches and appended a beautiful Pending Invites sidebar tracker grid list to view statuses, resend, or revoke actions instantly.Screenshots
Will add screenshots upon deployment to the staging environment due to a local dev auth loop. Tested via static type checking.
Checklist
npm run dev)