Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements the email service for workspace invitations (closes #20). It adds a complete backend flow for generating, sending, and handling workspace invitations via unique tokens, with SMTP email delivery and structured logging. The frontend gains new pages for accepting/declining invites and signing up via invite links, plus improvements to the settings page for managing pending invites.
Changes:
- Added backend SMTP email sender, email logging, and queue consumer integration for sending workspace invitation emails with configurable
APP_BASE_URL. - Created new public API endpoints (
/api/invitations/by-token/and/api/invitations/decline/) and frontend pages (InviteAcceptPage,InviteSignUpPage) for the invite acceptance flow. - Updated the frontend with theme-aware styling fixes (replacing hardcoded
bg-whitewith CSS custom properties), a FormData upload interceptor, pending invite context menus in settings, and sign-up integration via the auth service.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
api/internal/handler/invitation.go |
New handler for public invite token lookup and decline endpoints |
api/internal/handler/workspace.go |
Enqueues invite emails after creating workspace invitations |
api/internal/mail/mail.go |
New SMTP email sender loading config from instance settings |
api/internal/mail/logger.go |
Structured logging helpers for email delivery lifecycle |
api/internal/queue/queue.go |
Extended SendEmailPayload with optional invite_url |
api/internal/queue/consumer.go |
Updated email handler with logging and new sender signature |
api/internal/router/router.go |
Registered public invite endpoints and updated workspace handler init |
api/internal/config/config.go |
Added AppBaseURL config field |
api/cmd/api/main.go |
Wired up SMTP email sender and instance settings store |
api/.env.example |
Added APP_BASE_URL environment variable |
ui/src/pages/InviteAcceptPage.tsx |
New page for invite token acceptance/decline flow |
ui/src/pages/InviteSignUpPage.tsx |
New page for sign-up via invite token |
ui/src/pages/LoginPage.tsx |
Enhanced to support prefilled email and return-to-invite flow |
ui/src/pages/SettingsPage.tsx |
Added context menu for pending invites (copy link, remove) |
ui/src/pages/ProfilePage.tsx |
Theme-aware styling (bg-white → CSS custom properties) |
ui/src/services/invitationService.ts |
New service for public invitation APIs |
ui/src/services/workspaceService.ts |
Added joinByToken method |
ui/src/services/authService.ts |
Added signUp method |
ui/src/api/types.ts |
Added InviteByTokenResponse type |
ui/src/api/client.ts |
FormData Content-Type interceptor |
ui/src/routes/index.tsx |
Registered invite and sign-up routes |
ui/src/styles/tokens.css |
Updated --bg-canvas token |
ui/package.json / ui/package-lock.json |
Version bump to 0.3.2 |
Files not reviewed (1)
- ui/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces a complete backend and partial frontend implementation for public workspace invite links, including email delivery and invite management. The changes add support for generating, sending, and handling workspace invitations via unique tokens, and ensure robust email delivery with logging and configuration via instance settings. Additionally, it introduces a new API for invite token handling and improves the email queue and logging flows.
The most important changes are:
Workspace Invitation System & API:
InvitationHandlerinapi/internal/handler/invitation.gowith public endpoints to fetch invite details by token and to decline an invite, enabling the frontend to support invite acceptance and decline flows./api/invitations/by-token/and/api/invitations/decline/).InviteByTokenResponsefor invite token lookup in the frontend API types.Email Delivery and Logging:
api/internal/mail/mail.gothat loads SMTP settings from instance settings, sends emails, and logs all attempts, successes, failures, and skips.api/internal/mail/logger.go.Workspace Invite Email Flow:
WorkspaceHandlerto enqueue workspace invite emails with a proper invite link using the configured frontend base URL, and to include additional context in the queue payload. [1] [2]SendEmailPayload) to include an optionalinvite_urlfield for logging and debugging.Configuration and Environment:
APP_BASE_URLto.env.exampleand configuration structs, allowing the backend to generate correct invite links for emails. If unset, falls back toCORS_ORIGIN. [1] [2] [3] [4] [5]Frontend Improvements:
FormDatauploads by omitting theContent-Typeheader, preventing server-side parsing errors.0.3.2. [1] [2]Closes #20