Skip to content

Add HTML workspace invite email dispatch for issue 442#529

Open
parthpatidar03 wants to merge 1 commit into
param20h:devfrom
parthpatidar03:feature/442-workspace-invite-email
Open

Add HTML workspace invite email dispatch for issue 442#529
parthpatidar03 wants to merge 1 commit into
param20h:devfrom
parthpatidar03:feature/442-workspace-invite-email

Conversation

@parthpatidar03

Copy link
Copy Markdown

Closes #442


📝 What does this PR do?

When a user is invited to a workspace, the backend now immediately dispatches a branded HTML invitation email with workspace details and a one-click acceptance link.

Changes:

  • Added send_workspace_invite_email() to backend/app/email_service.py — builds a table-based HTML email with:
    • Indigo → purple branded header
    • Workspace name + invitation copy
    • Optional personal message block (only rendered when inviter adds a note)
    • Prominent "Accept Invitation →" CTA button
    • Amber expiry notice (e.g. "⏳ expires in 72 hours")
    • Auto-generated plain-text fallback for clients that don't render HTML
  • Updated backend/app/routes/workspaces.py to call send_workspace_invite_email() instead of the old hand-rolled plain-text body

🗂️ Type of Change

  • ✨ New feature
  • 🔧 Refactor / code cleanup
  • 🧪 Tests

🧪 How was this tested?

  • Added / updated tests

9 unit tests added in backend/tests/test_workspace_invite_email.py:

Test Asserts
test_delegates_to_send_email send_email called exactly once
test_subject_contains_workspace_name Subject includes workspace name
test_html_body_contains_invite_link HTML contains acceptance URL
test_html_body_contains_workspace_name HTML contains workspace name
test_html_body_contains_expiry Expiry hours present in HTML
test_personal_message_included_in_html Optional message block rendered
test_no_personal_message_omits_block Block absent when no message
test_plain_text_body_contains_invite_link Plain-text fallback has URL
test_recipient_passed_to_send_email Correct recipient address
pytest tests/test_workspace_invite_email.py -v --noconftest

9 passed in 0.29s ✅

Email renders correctly in Gmail, Outlook, and Apple Mail (table-based layout, inline CSS only).


✅ Self-Review Checklist

  • My branch is based on dev, not main
  • I have not added any secrets / API keys
  • I have not modified main branch or any HuggingFace deployment config
  • My code follows the existing style (no unnecessary formatting changes)
  • I have updated relevant docs / comments if needed

@parthpatidar03 parthpatidar03 requested a review from param20h as a code owner June 8, 2026 06:18
@parthpatidar03

Copy link
Copy Markdown
Author
image

@param20h

Copy link
Copy Markdown
Owner

issuesss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(api): Implement email notifications for workspace invites

2 participants