Skip to content

🙌 OpenHands: AI-Driven Development

feat: expose copyable invite links so invitations work without email delivery (#14758)

Alona444f56a6c03d
diff --git a/enterprise/server/routes/org_invitation_models.py b/enterprise/server/routes/org_invitation_models.py
index 5f416aaa78..3deaaf7034 100644
--- a/enterprise/server/routes/org_invitation_models.py
+++ b/enterprise/server/routes/org_invitation_models.py
@@ -3,6 +3,7 @@ Pydantic models and custom exceptions for organization invitations.
"""
from pydantic import BaseModel, EmailStr
+from server.services.email_service import EmailService
from storage.org_invitation import OrgInvitation
from storage.role_store import RoleStore
@@ -74,6 +75,10 @@ class InvitationResponse(BaseModel):
created_at: str
expires_at: str
inviter_email: str | None = None
+ # Absolute acceptance link for this invitation. Only surfaced through
+ # admin/owner-gated endpoints (creating or listing invitations), so the
+ # token is never exposed to regular members.
+ invite_url: str | None = None
@classmethod
async def from_invitation(
@@ -105,6 +110,7 @@ class InvitationResponse(BaseModel):
created_at=invitation.created_at.isoformat(),
expires_at=invitation.expires_at.isoformat(),
inviter_email=inviter_email,
+ invite_url=EmailService.build_invitation_url(invitation.token),
)
@@ -120,6 +126,22 @@ class BatchInvitationResponse(BaseModel):
successful: list[InvitationResponse]
failed: list[InvitationFailure]
+ # False when no email provider is configured (e.g. OHE installs without
+ # RESEND_API_KEY): invitations were created but no email was sent, so the
+ # UI should tell the inviter to share the invite links directly.
+ email_delivery_configured: bool = True
+
+
+class PendingInvitationsResponse(BaseModel):
+ """Response model for listing an org's pending invitations."""
+
+ items: list[InvitationResponse]
+ email_delivery_configured: bool = True
+ # True when this org is the bootstrapped default org and auto-add is on:
+ # anyone who signs in joins automatically, so invitations only matter for
+ # pre-assigning a role. Lets the UI say so instead of implying invites
+ # are the membership path.
+ auto_add_enabled: bool = False
class AcceptInvitationRequest(BaseModel):
diff --git a/enterprise/server/routes/org_invitations.py b/enterprise/server/routes/org_invitations.py
index 10d693983c..ca1a153870 100644
--- a/enterprise/server/routes/org_invitations.py
+++ b/enterprise/server/routes/org_invitations.py
@@ -4,6 +4,7 @@ from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, Request, status
from fastapi.responses import RedirectResponse
+from server.auth.authorization import Permission, require_permission
from server.auth.org_context import REJECT_X_ORG_ID_PATH_MISMATCH
from server.routes.org_invitation_models import (
AcceptInvitationRequest,
@@ -16,13 +17,16 @@ from server.routes.org_invitation_models import (
InvitationFailure,
InvitationInvalidError,
InvitationResponse,
+ PendingInvitationsResponse,
UserAlreadyMemberError,
)
+from server.services.email_service import EmailService
from server.services.org_invitation_service import OrgInvitationService
from server.utils.rate_limit_utils import (
RATE_LIMIT_ORG_INVITATION_USER_SECONDS,
check_rate_limit_by_user_id,
)
+from storage.default_org_service import get_default_org_config
from storage.org_store import OrgStore
from storage.role_store import RoleStore
@@ -145,6 +149,7 @@ async def create_invitation(
failed=[
InvitationFailure(email=email, error=error) for email, error in failed
],
+ email_delivery_configured=EmailService.is_configured(),
)
except InsufficientPermissionError as e:
@@ -168,6 +173,91 @@ async def create_invitation(
)
+@invitation_router.get(
+ '/invite',
+ response_model=PendingInvitationsResponse,
+)
+async def list_pending_invitations(
+ org_id: UUID,
+ user_id: str = Depends(require_permission(Permission.INVITE_USER_TO_ORGANIZATION)),
+):
+ """List an organization's pending invitations, including invite links.
+
+ Gated on the invite permission (admins/owners): responses include each
+ invitation's acceptance link so inviters can share it directly when no
+ email provider is configured.
+ """
+ try:
+ from storage.org_invitation_store import OrgInvitationStore
+
+ invitations = await OrgInvitationStore.get_pending_invitations_for_org(org_id)
+ items = [await InvitationResponse.from_invitation(inv) for inv in invitations]
+ return PendingInvitationsResponse(
+ items=items,
+ email_delivery_configured=EmailService.is_configured(),
+ auto_add_enabled=await _org_auto_adds_users(org_id),
+ )
+ except HTTPException:
+ raise
+ except Exception:
+ logger.exception(
+ 'Error listing pending invitations',
+ extra={'org_id': str(org_id)},
+ )
+ raise HTTPException(
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
+ detail='Failed to list pending invitations',
+ )
+
+
+async def _org_auto_adds_users(org_id: UUID) -> bool:
+ """Whether sign-in alone already makes users members of this org."""
+ config = get_default_org_config()
+ if not (config.enabled and config.auto_add_users):
+ return False
+ default_org = await OrgStore.get_default_org()
+ return default_org is not None and default_org.id == org_id
+
+
+@invitation_router.delete(
+ '/invite/{invitation_id}',
+ status_code=status.HTTP_204_NO_CONTENT,
+)
+async def revoke_invitation(
+ org_id: UUID,
+ invitation_id: int,
+ user_id: str = Depends(require_permission(Permission.INVITE_USER_TO_ORGANIZATION)),
+):
+ """Revoke a pending invitation, invalidating its token and invite link.
+
+ Gated on the invite permission (admins/owners), same as creating and
+ listing invitations.
+
+ Raises:
+ HTTPException 404: Unknown invitation, or it belongs to another org
+ HTTPException 409: Invitation is not pending (already accepted/expired)
+ """
+ try:
+ revoked = await OrgInvitationService.revoke_invitation(org_id, invitation_id)
+ except InvitationInvalidError as e:
+ raise HTTPException(status_code=status.HTTP_409_CONFLICT, detail=str(e))
+ except Exception:
+ logger.exception(
+ 'Error revoking invitation',
+ extra={'org_id': str(org_id), 'invitation_id': invitation_id},
+ )
+ raise HTTPException(
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
+ detail='Failed to revoke invitation',
+ )
+
+ if revoked is None:
+ raise HTTPException(
+ status_code=status.HTTP_404_NOT_FOUND,
+ detail='Invitation not found',
+ )
+
+
@accept_router.get('/accept')
async def accept_invitation_redirect(
token: str,
diff --git a/enterprise/server/services/email_service.py b/enterprise/server/services/email_service.py
index fb7b723b48..44f5fcf975 100644
--- a/enterprise/server/services/email_service.py
+++ b/enterprise/server/services/email_service.py
@@ -37,6 +37,33 @@ class EmailService:
resend.api_key = resend_api_key
return True
+ @staticmethod
+ def is_configured() -> bool:
+ """Whether transactional email delivery is configured.
+
+ Mirrors the checks in _get_resend_client without logging, so callers
+ can surface "email is not configured" to users instead of letting
+ invitations fail silently.
+ """
+ return RESEND_AVAILABLE and bool(os.environ.get('RESEND_API_KEY'))
+
+ @staticmethod
+ def build_invitation_url(invitation_token: str) -> str:
+ """Build the absolute acceptance URL for an invitation token.
+
+ WEB_HOST may be configured as a bare hostname (the OHE chart sets it
+ that way), so normalize to an https URL before composing the link.
+ """
+ web_host = os.environ.get('WEB_HOST', DEFAULT_WEB_HOST).strip().rstrip('/')
+ if not web_host:
+ web_host = DEFAULT_WEB_HOST
+ if not web_host.startswith(('http://', 'https://')):
+ web_host = f'https://{web_host}'
+ return (
+ f'{web_host}/api/organizations/members/invite/accept'
+ f'?token={invitation_token}'
+ )
+
@staticmethod
def send_invitation_email(
to_email: str,
@@ -59,9 +86,7 @@ class EmailService:
if not EmailService._get_resend_client():
return
- # Build invitation URL
- web_host = os.environ.get('WEB_HOST', DEFAULT_WEB_HOST)
- invitation_url = f'{web_host}/api/organizations/members/invite/accept?token={invitation_token}'
+ invitation_url = EmailService.build_invitation_url(invitation_token)
from_email = os.environ.get('RESEND_FROM_EMAIL', DEFAULT_FROM_EMAIL)
diff --git a/enterprise/server/services/org_invitation_service.py b/enterprise/server/services/org_invitation_service.py
index b84a379860..eb6e264d49 100644
--- a/enterprise/server/services/org_invitation_service.py
+++ b/enterprise/server/services/org_invitation_service.py
@@ -431,3 +431,32 @@ class OrgInvitationService:
)
return updated_invitation
+
+ @staticmethod
+ async def revoke_invitation(
+ org_id: UUID, invitation_id: int
+ ) -> OrgInvitation | None:
+ """Revoke a pending invitation, invalidating its token/link.
+
+ Returns None when the invitation doesn't exist or belongs to a
+ different org (the caller's org_id comes from the URL path, so a
+ mismatch must look identical to not-found).
+
+ Raises:
+ InvitationInvalidError: If the invitation is not pending
+ """
+ invitation = await OrgInvitationStore.get_invitation_by_id(invitation_id)
+ if not invitation or invitation.org_id != org_id:
+ return None
+
+ if invitation.status != OrgInvitation.STATUS_PENDING:
+ raise InvitationInvalidError('Only pending invitations can be revoked')
+
+ revoked = await OrgInvitationStore.update_invitation_status(
+ invitation_id, OrgInvitation.STATUS_REVOKED
+ )
+ logger.info(
+ 'Organization invitation revoked',
+ extra={'invitation_id': invitation_id, 'org_id': str(org_id)},
+ )
+ return revoked
diff --git a/enterprise/storage/org_invitation_store.py b/enterprise/storage/org_invitation_store.py
index 548677b008..ed21143b2c 100644
--- a/enterprise/storage/org_invitation_store.py
+++ b/enterprise/storage/org_invitation_store.py
@@ -117,6 +117,39 @@ class OrgInvitationStore:
)
return result.scalars().first()
+ @staticmethod
+ async def get_pending_invitations_for_org(org_id: UUID) -> list[OrgInvitation]:
+ """Get all pending invitations for an organization, newest first.
+
+ Args:
+ org_id: Organization UUID
+
+ Returns:
+ List of pending OrgInvitation rows
+ """
+ async with a_session_maker() as session:
+ result = await session.execute(
+ select(OrgInvitation)
+ .options(joinedload(OrgInvitation.role))
+ .filter(
+ and_(
+ OrgInvitation.org_id == org_id,
+ OrgInvitation.status == OrgInvitation.STATUS_PENDING,
+ )
+ )
+ .order_by(OrgInvitation.created_at.desc())
+ )
+ return list(result.scalars().all())
+
+ @staticmethod
+ async def get_invitation_by_id(invitation_id: int) -> Optional[OrgInvitation]:
+ """Get an invitation by its primary key."""
+ async with a_session_maker() as session:
+ result = await session.execute(
+ select(OrgInvitation).filter(OrgInvitation.id == invitation_id)
+ )
+ return result.scalars().first()
+
@staticmethod
async def get_pending_invitation(
org_id: UUID, email: str
diff --git a/enterprise/tests/unit/test_email_service.py b/enterprise/tests/unit/test_email_service.py
index 0ea63e0496..ac1d82beb4 100644
--- a/enterprise/tests/unit/test_email_service.py
+++ b/enterprise/tests/unit/test_email_service.py
@@ -3,6 +3,7 @@
import os
from unittest.mock import MagicMock, patch
+import pytest
from server.services.email_service import (
DEFAULT_WEB_HOST,
EmailService,
@@ -190,3 +191,41 @@ class TestEmailServiceSendInvitationEmail:
assert 'John Doe' in email_params['html']
assert 'Acme Corp' in email_params['html']
assert 'admin' in email_params['html']
+
+
+class TestEmailServiceHelpers:
+ """Tests for is_configured and build_invitation_url."""
+
+ def test_is_configured_false_without_api_key(self, monkeypatch):
+ monkeypatch.delenv('RESEND_API_KEY', raising=False)
+ from server.services.email_service import EmailService
+
+ assert EmailService.is_configured() is False
+
+ def test_is_configured_true_with_api_key(self, monkeypatch):
+ monkeypatch.setenv('RESEND_API_KEY', 'test-key')
+ from server.services import email_service
+
+ if not email_service.RESEND_AVAILABLE:
+ pytest.skip('resend library not installed')
+ assert email_service.EmailService.is_configured() is True
+
+ def test_build_invitation_url_normalizes_bare_hostname(self, monkeypatch):
+ """OHE charts set WEB_HOST as a bare hostname; links must get a scheme."""
+ monkeypatch.setenv('WEB_HOST', 'app.example.com')
+ from server.services.email_service import EmailService
+
+ url = EmailService.build_invitation_url('inv-token123')
+
+ assert url == (
+ 'https://app.example.com/api/organizations/members/invite/accept'
+ '?token=inv-token123'
+ )
+
+ def test_build_invitation_url_keeps_explicit_scheme(self, monkeypatch):
+ monkeypatch.setenv('WEB_HOST', 'https://app.example.com/')
+ from server.services.email_service import EmailService
+
+ url = EmailService.build_invitation_url('inv-token123')
+
+ assert url.startswith('https://app.example.com/api/')
diff --git a/enterprise/tests/unit/test_org_invitation_service.py b/enterprise/tests/unit/test_org_invitation_service.py
index 26bfe25e88..b4005743c8 100644
--- a/enterprise/tests/unit/test_org_invitation_service.py
+++ b/enterprise/tests/unit/test_org_invitation_service.py
@@ -742,3 +742,81 @@ class TestAcceptInvitationAlreadyAccepted:
with pytest.raises(InvitationInvalidError):
await OrgInvitationService.accept_invitation('inv-token', user_id)
+
+
+class TestRevokeInvitation:
+ """Revoking pending invitations."""
+
+ def _invitation(self, status=OrgInvitation.STATUS_PENDING):
+ invitation = MagicMock(spec=OrgInvitation)
+ invitation.id = 7
+ invitation.org_id = UUID('12345678-1234-5678-1234-567812345678')
+ invitation.status = status
+ return invitation
+
+ @pytest.mark.asyncio
+ async def test_revoke_pending_invitation(self):
+ invitation = self._invitation()
+
+ with (
+ patch(
+ 'server.services.org_invitation_service.OrgInvitationStore.get_invitation_by_id',
+ new_callable=AsyncMock,
+ return_value=invitation,
+ ),
+ patch(
+ 'server.services.org_invitation_service.OrgInvitationStore.update_invitation_status',
+ new_callable=AsyncMock,
+ ) as mock_update,
+ ):
+ mock_update.return_value = invitation
+ result = await OrgInvitationService.revoke_invitation(
+ invitation.org_id, invitation.id
+ )
+
+ assert result is invitation
+ mock_update.assert_awaited_once_with(
+ invitation.id, OrgInvitation.STATUS_REVOKED
+ )
+
+ @pytest.mark.asyncio
+ async def test_revoke_unknown_invitation_returns_none(self):
+ with patch(
+ 'server.services.org_invitation_service.OrgInvitationStore.get_invitation_by_id',
+ new_callable=AsyncMock,
+ return_value=None,
+ ):
+ result = await OrgInvitationService.revoke_invitation(
+ UUID('12345678-1234-5678-1234-567812345678'), 999
+ )
+
+ assert result is None
+
+ @pytest.mark.asyncio
+ async def test_revoke_other_orgs_invitation_returns_none(self):
+ invitation = self._invitation()
+
+ with patch(
+ 'server.services.org_invitation_service.OrgInvitationStore.get_invitation_by_id',
+ new_callable=AsyncMock,
+ return_value=invitation,
+ ):
+ result = await OrgInvitationService.revoke_invitation(
+ UUID('99999999-9999-9999-9999-999999999999'), invitation.id
+ )
+
+ assert result is None
+
+ @pytest.mark.asyncio
+ async def test_revoke_non_pending_invitation_raises(self):
+ invitation = self._invitation(status=OrgInvitation.STATUS_ACCEPTED)
+
+ with patch(
+ 'server.services.org_invitation_service.OrgInvitationStore.get_invitation_by_id',
+ new_callable=AsyncMock,
+ return_value=invitation,
+ ):
+ with pytest.raises(InvitationInvalidError):
+ await OrgInvitationService.revoke_invitation(
+ invitation.org_id, invitation.id
+ )
diff --git a/enterprise/tests/unit/test_org_invitations_router.py b/enterprise/tests/unit/test_org_invitations_router.py
index 6e6a315a8b..35f992ca21 100644
--- a/enterprise/tests/unit/test_org_invitations_router.py
+++ b/enterprise/tests/unit/test_org_invitations_router.py
@@ -352,3 +352,73 @@ class TestCreateInvitationBatchEndpoint:
assert response.status_code == 400
assert 'Invalid role' in response.json()['detail']
+
+
+class TestOrgAutoAddsUsers:
+ """The auto_add_enabled hint on the pending-invitations response."""
+
+ @pytest.mark.asyncio
+ async def test_true_for_default_org_with_auto_add(self):
+ from uuid import UUID
+
+ from server.routes.org_invitations import _org_auto_adds_users
+
+ org_id = UUID('12345678-1234-5678-1234-567812345678')
+ default_org = MagicMock()
+ default_org.id = org_id
+
+ config = MagicMock(enabled=True, auto_add_users=True)
+ with (
+ patch(
+ 'server.routes.org_invitations.get_default_org_config',
+ return_value=config,
+ ),
+ patch(
+ 'server.routes.org_invitations.OrgStore.get_default_org',
+ new_callable=AsyncMock,
+ return_value=default_org,
+ ),
+ ):
+ assert await _org_auto_adds_users(org_id) is True
+
+ @pytest.mark.asyncio
+ async def test_false_when_auto_add_disabled(self):
+ from uuid import UUID
+
+ from server.routes.org_invitations import _org_auto_adds_users
+
+ config = MagicMock(enabled=True, auto_add_users=False)
+ with patch(
+ 'server.routes.org_invitations.get_default_org_config',
+ return_value=config,
+ ):
+ assert (
+ await _org_auto_adds_users(UUID('12345678-1234-5678-1234-567812345678'))
+ is False
+ )
+
+ @pytest.mark.asyncio
+ async def test_false_for_non_default_org(self):
+ from uuid import UUID
+
+ from server.routes.org_invitations import _org_auto_adds_users
+
+ default_org = MagicMock()
+ default_org.id = UUID('99999999-9999-9999-9999-999999999999')
+
+ config = MagicMock(enabled=True, auto_add_users=True)
+ with (
+ patch(
+ 'server.routes.org_invitations.get_default_org_config',
+ return_value=config,
+ ),
+ patch(
+ 'server.routes.org_invitations.OrgStore.get_default_org',
+ new_callable=AsyncMock,
+ return_value=default_org,
+ ),
+ ):
+ assert (
+ await _org_auto_adds_users(UUID('12345678-1234-5678-1234-567812345678'))
+ is False
+ )
diff --git a/frontend/__tests__/components/features/org/invite-organization-member-modal.test.tsx b/frontend/__tests__/components/features/org/invite-organization-member-modal.test.tsx
index a8d82e2c7a..619544e914 100644
--- a/frontend/__tests__/components/features/org/invite-organization-member-modal.test.tsx
+++ b/frontend/__tests__/components/features/org/invite-organization-member-modal.test.tsx
@@ -28,6 +28,11 @@ const renderInviteOrganizationMemberModal = (config?: {
describe("InviteOrganizationMemberModal", () => {
beforeEach(() => {
useSelectedOrganizationStore.setState({ organizationId: "1" });
+ vi.spyOn(organizationService, "getPendingInvitations").mockResolvedValue({
+ items: [],
+ email_delivery_configured: false,
+ auto_add_enabled: false,
+ });
});
afterEach(() => {
@@ -169,6 +174,93 @@ describe("InviteOrganizationMemberModal", () => {
expect(inviteMembersSpy).not.toHaveBeenCalled();
});
+ it("should show invite links instead of closing when email delivery is not configured", async () => {
+ vi.spyOn(organizationService, "inviteMembers").mockResolvedValue({
+ successful: [
+ {
+ id: 1,
+ email: "[email protected]",
+ role: "member",
+ status: "pending",
+ created_at: "2026-01-01T00:00:00Z",
+ expires_at: "2026-01-08T00:00:00Z",
+ invite_url:
+ "https://app.example.com/api/organizations/members/invite/accept?token=inv-abc",
+ },
+ ],
+ failed: [],
+ email_delivery_configured: false,
+ });
+ const onCloseMock = vi.fn();
+
+ renderInviteOrganizationMemberModal({ onClose: onCloseMock });
+
+ const modal = screen.getByTestId("invite-modal");
+ const badgeInput = within(modal).getByTestId("emails-badge-input");
+ await userEvent.type(badgeInput, "[email protected] ");
+ const submitButton = within(modal).getByRole("button", { name: /add/i });
+ await userEvent.click(submitButton);
+
+ // The links are the only way the invitee can join, so the modal stays
+ // open showing them with copy buttons instead of closing.
+ const linksModal = await screen.findByTestId("invite-links-modal");
+ expect(onCloseMock).not.toHaveBeenCalled();
+ expect(
+ within(linksModal).getByTestId("copy-invite-link-button"),
+ ).toBeInTheDocument();
+ expect(
+ within(linksModal).getByText("[email protected]"),
+ ).toBeInTheDocument();
+ });
+
+ it("should show the auto-add hint when sign-in already adds users to the org", async () => {
+ vi.spyOn(organizationService, "getPendingInvitations").mockResolvedValue({
+ items: [],
+ email_delivery_configured: false,
+ auto_add_enabled: true,
+ });
+
+ renderInviteOrganizationMemberModal();
+
+ expect(
+ await screen.findByTestId("auto-add-enabled-hint"),
+ ).toBeInTheDocument();
+ });
+
+ it("should show failures without the share-links hint when email is configured but some invites fail", async () => {
+ vi.spyOn(organizationService, "inviteMembers").mockResolvedValue({
+ successful: [
+ {
+ id: 1,
+ email: "[email protected]",
+ role: "member",
+ status: "pending",
+ created_at: "2026-01-01T00:00:00Z",
+ expires_at: "2026-01-08T00:00:00Z",
+ invite_url: "https://app.example.com/accept?token=inv-ok",
+ },
+ ],
+ failed: [{ email: "[email protected]", error: "User is already a member" }],
+ email_delivery_configured: true,
+ });
+ const onCloseMock = vi.fn();
+
+ renderInviteOrganizationMemberModal({ onClose: onCloseMock });
+
+ const modal = screen.getByTestId("invite-modal");
+ const badgeInput = within(modal).getByTestId("emails-badge-input");
+ await userEvent.type(badgeInput, "[email protected] [email protected] ");
+ await userEvent.click(within(modal).getByRole("button", { name: /add/i }));
+
+ // Modal stays open so the inviter can see what failed...
+ const linksModal = await screen.findByTestId("invite-links-modal");
+ expect(onCloseMock).not.toHaveBeenCalled();
+ expect(within(linksModal).getByText("[email protected]")).toBeInTheDocument();
+ // ...but the "share these links" hint is wrong when emails were sent.
+ expect(
+ within(linksModal).queryByText("ORG$INVITATIONS_CREATED_SHARE_LINKS"),
+ ).not.toBeInTheDocument();
+ });
it("should invite a typed email even when it was never committed with space", async () => {
const inviteMembersBatchSpy = vi.spyOn(
organizationService,
diff --git a/frontend/__tests__/routes/manage-organization-members.test.tsx b/frontend/__tests__/routes/manage-organization-members.test.tsx
index d79d263fac..20d373ea3c 100644
--- a/frontend/__tests__/routes/manage-organization-members.test.tsx
+++ b/frontend/__tests__/routes/manage-organization-members.test.tsx
@@ -112,7 +112,7 @@ describe("Manage Organization Members Route", () => {
hide_users_page: false,
hide_billing_page: false,
hide_integrations_page: false,
- enable_onboarding: false,
+ enable_onboarding: false,
},
}),
);
@@ -125,6 +125,13 @@ describe("Manage Organization Members Route", () => {
currentOrgId: MOCK_TEAM_ORG_ACME.id,
});
+ // Default: no pending invitations (individual tests override)
+ vi.spyOn(organizationService, "getPendingInvitations").mockResolvedValue({
+ items: [],
+ email_delivery_configured: false,
+ auto_add_enabled: false,
+ });
+
// Set default mock for user (admin role has invite permission)
getMeSpy.mockResolvedValue({
org_id: "1",
@@ -598,7 +605,6 @@ describe("Manage Organization Members Route", () => {
expect(screen.queryByText("[email protected]")).not.toBeInTheDocument();
});
-
describe("Inviting Organization Members", () => {
it("should render an invite organization member button", async () => {
await setupInviteTest();
@@ -1036,4 +1042,60 @@ describe("Manage Organization Members Route", () => {
expect(updateMemberRoleSpy).not.toHaveBeenCalled();
});
});
+
+ describe("pending invitations rows", () => {
+ const PENDING_INVITATION = {
+ id: 5,
+ email: "[email protected]",
+ role: "member",
+ status: "pending",
+ created_at: "2026-01-01T00:00:00Z",
+ expires_at: "2026-01-08T00:00:00Z",
+ invite_url: "https://app.example.com/accept?token=inv-abc",
+ };
+
+ it("should render pending invitations as rows in the members list with copy + revoke actions", async () => {
+ vi.spyOn(organizationService, "getPendingInvitations").mockResolvedValue({
+ items: [PENDING_INVITATION],
+ email_delivery_configured: false,
+ auto_add_enabled: false,
+ });
+
+ renderManageOrganizationMembers();
+
+ const row = await screen.findByTestId("pending-invitation-item");
+ expect(within(row).getByText("[email protected]")).toBeInTheDocument();
+ expect(
+ within(row).getByTestId("copy-invite-link-button"),
+ ).toBeInTheDocument();
+ expect(
+ within(row).getByTestId("revoke-invitation-button"),
+ ).toBeInTheDocument();
+ });
+
+ it("should revoke an invitation when the revoke button is clicked", async () => {
+ vi.spyOn(organizationService, "getPendingInvitations").mockResolvedValue({
+ items: [PENDING_INVITATION],
+ email_delivery_configured: false,
+ auto_add_enabled: false,
+ });
+ const revokeSpy = vi
+ .spyOn(organizationService, "revokeInvitation")
+ .mockResolvedValue(undefined);
+
+ renderManageOrganizationMembers();
+
+ const row = await screen.findByTestId("pending-invitation-item");
+ await userEvent.click(
+ within(row).getByTestId("revoke-invitation-button"),
+ );
+
+ await waitFor(() =>
+ expect(revokeSpy).toHaveBeenCalledExactlyOnceWith({
+ orgId: MOCK_TEAM_ORG_ACME.id,
+ invitationId: 5,
+ }),
+ );
+ });
+ });
});
diff --git a/frontend/src/api/organization-service/organization-service.api.ts b/frontend/src/api/organization-service/organization-service.api.ts
index cdb4625a04..7c95b9703b 100644
--- a/frontend/src/api/organization-service/organization-service.api.ts
+++ b/frontend/src/api/organization-service/organization-service.api.ts
@@ -1,4 +1,6 @@
import {
+ PendingInvitationsPage,
+ BatchInvitationResult,
GitOrgClaim,
Organization,
OrganizationMember,
@@ -146,7 +148,7 @@ export const organizationService = {
emails: string[];
role?: OrganizationUserRole;
}) => {
- const { data } = await openHands.post<OrganizationMember[]>(
+ const { data } = await openHands.post<BatchInvitationResult>(
`/api/organizations/${orgId}/members/invite`,
{
emails,
@@ -157,6 +159,26 @@ export const organizationService = {
return data;
},
+ getPendingInvitations: async ({ orgId }: { orgId: string }) => {
+ const { data } = await openHands.get<PendingInvitationsPage>(
+ `/api/organizations/${orgId}/members/invite`,
+ );
+
+ return data;
+ },
+
+ revokeInvitation: async ({
+ orgId,
+ invitationId,
+ }: {
+ orgId: string;
+ invitationId: number;
+ }) => {
+ await openHands.delete(
+ `/api/organizations/${orgId}/members/invite/${invitationId}`,
+ );
+ },
+
switchOrganization: async ({ orgId }: { orgId: string }) => {
const { data } = await openHands.post<Organization>(
`/api/organizations/${orgId}/switch`,
diff --git a/frontend/src/components/features/org/copy-invite-link-button.tsx b/frontend/src/components/features/org/copy-invite-link-button.tsx
new file mode 100644
index 0000000000..90b4acbbec
--- /dev/null
+++ b/frontend/src/components/features/org/copy-invite-link-button.tsx
@@ -0,0 +1,37 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { Check, Link as LinkIcon } from "lucide-react";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+
+interface CopyInviteLinkButtonProps {
+ inviteUrl: string;
+}
+
+export function CopyInviteLinkButton({ inviteUrl }: CopyInviteLinkButtonProps) {
+ const { t } = useTranslation();
+ const [copied, setCopied] = React.useState(false);
+
+ const handleCopy = async () => {
+ await navigator.clipboard.writeText(inviteUrl);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ };
+
+ return (
+ <button
+ type="button"
+ data-testid="copy-invite-link-button"
+ onClick={handleCopy}
+ className={cn(
+ "flex items-center gap-1 text-xs cursor-pointer hover:underline shrink-0",
+ copied ? "text-success" : "text-primary",
+ )}
+ >
+ {copied ? <Check size={12} /> : <LinkIcon size={12} />}
+ {copied
+ ? t(I18nKey.ORG$INVITE_LINK_COPIED)
+ : t(I18nKey.ORG$COPY_INVITE_LINK)}
+ </button>
+ );
+}
diff --git a/frontend/src/components/features/org/invite-organization-member-modal.tsx b/frontend/src/components/features/org/invite-organization-member-modal.tsx
index c389315389..85c32747f5 100644
--- a/frontend/src/components/features/org/invite-organization-member-modal.tsx
+++ b/frontend/src/components/features/org/invite-organization-member-modal.tsx
@@ -7,7 +7,9 @@ import { I18nKey } from "#/i18n/declaration";
import { displayErrorToast } from "#/utils/custom-toast-handlers";
import { areAllEmailsValid, hasDuplicates } from "#/utils/input-validation";
import { Dropdown } from "#/ui/dropdown/dropdown";
-import { OrganizationUserRole } from "#/types/org";
+import { BatchInvitationResult, OrganizationUserRole } from "#/types/org";
+import { CopyInviteLinkButton } from "#/components/features/org/copy-invite-link-button";
+import { usePendingInvitations } from "#/hooks/query/use-pending-invitations";
interface InviteOrganizationMemberModalProps {
onClose: (event?: React.MouseEvent<HTMLButtonElement>) => void;
@@ -18,8 +20,14 @@ export function InviteOrganizationMemberModal({
}: InviteOrganizationMemberModalProps) {
const { t } = useTranslation();
const { mutate: inviteMembers, isPending } = useInviteMembersBatch();
+ // The modal is only reachable with the invite permission, which is what
+ // gates the backing endpoint; the response carries auto_add_enabled.
+ const { data: pendingData } = usePendingInvitations(true);
const [emails, setEmails] = React.useState<string[]>([]);
const [role, setRole] = React.useState<OrganizationUserRole>("member");
+ const [result, setResult] = React.useState<BatchInvitationResult | null>(
+ null,
+ );
const handleEmailsChange = (newEmails: string[]) => {
const trimmedEmails = newEmails.map((email) => email.trim());
@@ -45,7 +53,17 @@ export function InviteOrganizationMemberModal({
inviteMembers(
{ emails, role },
{
- onSuccess: () => onClose(),
+ onSuccess: (data) => {
+ // When email delivery works, the invitees are notified and the
+ // modal can simply close. Without it, the links are the only way
+ // invitees can ever join — keep the modal open so the inviter can
+ // copy them.
+ if (data.email_delivery_configured && data.failed.length === 0) {
+ onClose();
+ } else {
+ setResult(data);
+ }
+ },
},
);
};
@@ -55,6 +73,54 @@ export function InviteOrganizationMemberModal({
{ value: "admin", label: t(I18nKey.ORG$ROLE_ADMIN) },
];
+ if (result) {
+ return (
+ <OrgModal
+ testId="invite-links-modal"
+ title={t(I18nKey.ORG$INVITE_ORG_MEMBERS)}
+ description={
+ result.email_delivery_configured
+ ? undefined
+ : t(I18nKey.ORG$EMAIL_DELIVERY_NOT_CONFIGURED)
+ }
+ primaryButtonText={t(I18nKey.BUTTON$CLOSE)}
+ onPrimaryClick={() => onClose()}
+ onClose={onClose}
+ >
+ <div className="flex flex-col gap-2" data-testid="invite-links-list">
+ {/* With email configured the modal only stays open to show failures;
+ "share these links" is only accurate when no email was sent. */}
+ {!result.email_delivery_configured &&
+ result.successful.length > 0 && (
+ <span className="text-sm">
+ {t(I18nKey.ORG$INVITATIONS_CREATED_SHARE_LINKS)}
+ </span>
+ )}
+ {result.successful.map((invitation) => (
+ <div
+ key={invitation.id}
+ className="flex items-center justify-between gap-2 text-sm"
+ >
+ <span className="truncate">{invitation.email}</span>
+ {invitation.invite_url && (
+ <CopyInviteLinkButton inviteUrl={invitation.invite_url} />
+ )}
+ </div>
+ ))}
+ {result.failed.map((failure) => (
+ <div
+ key={failure.email}
+ className="flex items-center justify-between gap-2 text-sm text-danger"
+ >
+ <span className="truncate">{failure.email}</span>
+ <span className="truncate">{failure.error}</span>
+ </div>
+ ))}
+ </div>
+ </OrgModal>
+ );
+ }
+
return (
<OrgModal
testId="invite-modal"
@@ -65,6 +131,14 @@ export function InviteOrganizationMemberModal({
onClose={onClose}
isLoading={isPending}
>
+ {pendingData?.auto_add_enabled && (
+ <p
+ data-testid="auto-add-enabled-hint"
+ className="text-xs text-tertiary-alt"
+ >
+ {t(I18nKey.ORG$AUTO_ADD_ENABLED_HINT)}
+ </p>
+ )}
<BadgeInput
name="emails-badge-input"
value={emails}
diff --git a/frontend/src/components/features/org/pending-invitation-list-item.tsx b/frontend/src/components/features/org/pending-invitation-list-item.tsx
new file mode 100644
index 0000000000..889804e352
--- /dev/null
+++ b/frontend/src/components/features/org/pending-invitation-list-item.tsx
@@ -0,0 +1,60 @@
+import { useTranslation } from "react-i18next";
+import { X } from "lucide-react";
+import { OrganizationInvitation } from "#/types/org";
+import { I18nKey } from "#/i18n/declaration";
+import { CopyInviteLinkButton } from "#/components/features/org/copy-invite-link-button";
+
+interface PendingInvitationListItemProps {
+ invitation: OrganizationInvitation;
+ onRevoke: () => void;
+ isRevoking: boolean;
+}
+
+/**
+ * A pending invitation rendered as a row in the members list, styled to
+ * match OrganizationMemberListItem with an "Invited" status chip. Instead
+ * of the role menu it offers copy-invite-link and revoke actions.
+ */
+export function PendingInvitationListItem({
+ invitation,
+ onRevoke,
+ isRevoking,
+}: PendingInvitationListItemProps) {
+ const { t } = useTranslation();
+
+ return (
+ <div
+ data-testid="pending-invitation-item"
+ className="flex items-center justify-between py-4"
+ >
+ <div className="flex items-center gap-2 min-w-0">
+ <span className="text-sm font-semibold leading-6 text-gray-400 truncate">
+ {invitation.email}
+ </span>
+ <span className="text-xs text-tertiary-light border border-tertiary px-2 py-1 rounded-lg shrink-0">
+ {t(I18nKey.ORG$STATUS_INVITED)}
+ </span>
+ </div>
+
+ <div className="flex items-center gap-4 shrink-0">
+ <span className="text-xs font-normal leading-4 text-org-text capitalize">
+ {invitation.role}
+ </span>
+ {invitation.invite_url && (
+ <CopyInviteLinkButton inviteUrl={invitation.invite_url} />
+ )}
+ <button
+ type="button"
+ data-testid="revoke-invitation-button"
+ aria-label={t(I18nKey.ORG$REVOKE_INVITATION)}
+ title={t(I18nKey.ORG$REVOKE_INVITATION)}
+ onClick={onRevoke}
+ disabled={isRevoking}
+ className="text-tertiary-alt hover:text-danger cursor-pointer disabled:cursor-not-allowed"
+ >
+ <X size={14} />
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/frontend/src/hooks/mutation/use-invite-members-batch.ts b/frontend/src/hooks/mutation/use-invite-members-batch.ts
index 7a3af31ed4..2d0c17c616 100644
--- a/frontend/src/hooks/mutation/use-invite-members-batch.ts
+++ b/frontend/src/hooks/mutation/use-invite-members-batch.ts
@@ -37,6 +37,9 @@ export const useInviteMembersBatch = () => {
queryClient.invalidateQueries({
queryKey: ["organizations", "members", organizationId],
});
+ queryClient.invalidateQueries({
+ queryKey: ["organizations", "pending-invitations", organizationId],
+ });
},
onError: (error) => {
const errorMessage = retrieveAxiosErrorMessage(error);
diff --git a/frontend/src/hooks/mutation/use-revoke-invitation.ts b/frontend/src/hooks/mutation/use-revoke-invitation.ts
new file mode 100644
index 0000000000..d2e315b8b2
--- /dev/null
+++ b/frontend/src/hooks/mutation/use-revoke-invitation.ts
@@ -0,0 +1,36 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import { organizationService } from "#/api/organization-service/organization-service.api";
+import { useSelectedOrganizationId } from "#/context/use-selected-organization";
+import { I18nKey } from "#/i18n/declaration";
+import {
+ displayErrorToast,
+ displaySuccessToast,
+} from "#/utils/custom-toast-handlers";
+
+export const useRevokeInvitation = () => {
+ const queryClient = useQueryClient();
+ const { organizationId } = useSelectedOrganizationId();
+ const { t } = useTranslation();
+
+ return useMutation({
+ mutationFn: ({ invitationId }: { invitationId: number }) => {
+ if (!organizationId) {
+ throw new Error("Organization ID is required");
+ }
+ return organizationService.revokeInvitation({
+ orgId: organizationId,
+ invitationId,
+ });
+ },
+ onSuccess: () => {
+ displaySuccessToast(t(I18nKey.ORG$INVITATION_REVOKED));
+ queryClient.invalidateQueries({
+ queryKey: ["organizations", "pending-invitations", organizationId],
+ });
+ },
+ onError: () => {
+ displayErrorToast(t(I18nKey.ORG$INVITATION_REVOKE_ERROR));
+ },
+ });
+};
diff --git a/frontend/src/hooks/query/use-pending-invitations.ts b/frontend/src/hooks/query/use-pending-invitations.ts
new file mode 100644
index 0000000000..2a31a2caa6
--- /dev/null
+++ b/frontend/src/hooks/query/use-pending-invitations.ts
@@ -0,0 +1,19 @@
+import { useQuery } from "@tanstack/react-query";
+import { organizationService } from "#/api/organization-service/organization-service.api";
+import { useSelectedOrganizationId } from "#/context/use-selected-organization";
+
+/**
+ * Pending invitations for the current org, including invite links.
+ * The backing endpoint is gated on the invite permission (admins/owners),
+ * so only enable this for callers that hold it.
+ */
+export const usePendingInvitations = (enabled: boolean) => {
+ const { organizationId } = useSelectedOrganizationId();
+
+ return useQuery({
+ queryKey: ["organizations", "pending-invitations", organizationId],
+ queryFn: () =>
+ organizationService.getPendingInvitations({ orgId: organizationId! }),
+ enabled: enabled && !!organizationId,
+ });
+};
diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.ts
index ba31d0da4e..73dfbb8353 100644
--- a/frontend/src/i18n/declaration.ts
+++ b/frontend/src/i18n/declaration.ts
@@ -1569,4 +1569,14 @@ export enum I18nKey {
SETTINGS$ACP_SECRET_GCP_LOCATION_HINT = "SETTINGS$ACP_SECRET_GCP_LOCATION_HINT",
SETTINGS$ACP_SECRET_VERTEXAI_FLAG_HINT = "SETTINGS$ACP_SECRET_VERTEXAI_FLAG_HINT",
ORG$INVITE_ROLE_LABEL = "ORG$INVITE_ROLE_LABEL",
+ ORG$PENDING_INVITATIONS = "ORG$PENDING_INVITATIONS",
+ ORG$EMAIL_DELIVERY_NOT_CONFIGURED = "ORG$EMAIL_DELIVERY_NOT_CONFIGURED",
+ ORG$INVITATIONS_CREATED_SHARE_LINKS = "ORG$INVITATIONS_CREATED_SHARE_LINKS",
+ ORG$NO_PENDING_INVITATIONS = "ORG$NO_PENDING_INVITATIONS",
+ ORG$REVOKE_INVITATION = "ORG$REVOKE_INVITATION",
+ ORG$INVITATION_REVOKED = "ORG$INVITATION_REVOKED",
+ ORG$INVITATION_REVOKE_ERROR = "ORG$INVITATION_REVOKE_ERROR",
+ ORG$AUTO_ADD_ENABLED_HINT = "ORG$AUTO_ADD_ENABLED_HINT",
+ ORG$COPY_INVITE_LINK = "ORG$COPY_INVITE_LINK",
+ ORG$INVITE_LINK_COPIED = "ORG$INVITE_LINK_COPIED",
}
diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json
index 7ab5637b4a..f96871600b 100644
--- a/frontend/src/i18n/translation.json
+++ b/frontend/src/i18n/translation.json
@@ -26671,5 +26671,175 @@
"uk": "Запросити як",
"zh-CN": "邀请身份",
"zh-TW": "邀請身分"
+ },
+ "ORG$PENDING_INVITATIONS": {
+ "en": "Pending Invitations",
+ "ja": "保留中の招待",
+ "zh-CN": "待处理的邀请",
+ "zh-TW": "待處理的邀請",
+ "ko-KR": "대기 중인 초대",
+ "no": "Ventende invitasjoner",
+ "it": "Inviti in sospeso",
+ "pt": "Convites pendentes",
+ "es": "Invitaciones pendientes",
+ "ar": "الدعوات المعلقة",
+ "fr": "Invitations en attente",
+ "tr": "Bekleyen davetler",
+ "de": "Ausstehende Einladungen",
+ "uk": "Очікувані запрошення",
+ "ca": "Invitacions pendents"
+ },
+ "ORG$EMAIL_DELIVERY_NOT_CONFIGURED": {
+ "en": "Email delivery is not configured on this instance. Share invite links with invitees directly.",
+ "ja": "このインスタンスではメール配信が設定されていません。招待リンクを直接共有してください。",
+ "zh-CN": "此实例未配置电子邮件发送。请直接分享邀请链接。",
+ "zh-TW": "此執行個體未設定電子郵件傳送。請直接分享邀請連結。",
+ "ko-KR": "이 인스턴스에는 이메일 전송이 구성되어 있지 않습니다. 초대 링크를 직접 공유하세요.",
+ "no": "E-postlevering er ikke konfigurert på denne instansen. Del invitasjonslenker direkte.",
+ "it": "L'invio di email non è configurato su questa istanza. Condividi direttamente i link di invito.",
+ "pt": "O envio de e-mail não está configurado nesta instância. Compartilhe os links de convite diretamente.",
+ "es": "El envío de correo no está configurado en esta instancia. Comparte los enlaces de invitación directamente.",
+ "ar": "لم يتم تكوين تسليم البريد الإلكتروني في هذا المثيل. شارك روابط الدعوة مباشرة.",
+ "fr": "L'envoi d'e-mails n'est pas configuré sur cette instance. Partagez directement les liens d'invitation.",
+ "tr": "Bu örnekte e-posta gönderimi yapılandırılmamış. Davet bağlantılarını doğrudan paylaşın.",
+ "de": "Der E-Mail-Versand ist auf dieser Instanz nicht konfiguriert. Teilen Sie Einladungslinks direkt.",
+ "uk": "Надсилання електронної пошти не налаштовано на цьому екземплярі. Поділіться посиланнями на запрошення безпосередньо.",
+ "ca": "L'enviament de correu no està configurat en aquesta instància. Comparteix els enllaços d'invitació directament."
+ },
+ "ORG$INVITATIONS_CREATED_SHARE_LINKS": {
+ "en": "Invitations created. Share these links with the invitees:",
+ "ja": "招待を作成しました。これらのリンクを招待者に共有してください:",
+ "zh-CN": "邀请已创建。请将这些链接分享给受邀者:",
+ "zh-TW": "邀請已建立。請將這些連結分享給受邀者:",
+ "ko-KR": "초대가 생성되었습니다. 이 링크를 초대 대상자와 공유하세요:",
+ "no": "Invitasjoner opprettet. Del disse lenkene med de inviterte:",
+ "it": "Inviti creati. Condividi questi link con gli invitati:",
+ "pt": "Convites criados. Compartilhe estes links com os convidados:",
+ "es": "Invitaciones creadas. Comparte estos enlaces con los invitados:",
+ "ar": "تم إنشاء الدعوات. شارك هذه الروابط مع المدعوين:",
+ "fr": "Invitations créées. Partagez ces liens avec les invités :",
+ "tr": "Davetler oluşturuldu. Bu bağlantıları davetlilerle paylaşın:",
+ "de": "Einladungen erstellt. Teilen Sie diese Links mit den Eingeladenen:",
+ "uk": "Запрошення створено. Поділіться цими посиланнями із запрошеними:",
+ "ca": "Invitacions creades. Comparteix aquests enllaços amb els convidats:"
+ },
+ "ORG$NO_PENDING_INVITATIONS": {
+ "en": "No pending invitations",
+ "ja": "保留中の招待はありません",
+ "zh-CN": "没有待处理的邀请",
+ "zh-TW": "沒有待處理的邀請",
+ "ko-KR": "대기 중인 초대가 없습니다",
+ "no": "Ingen ventende invitasjoner",
+ "it": "Nessun invito in sospeso",
+ "pt": "Nenhum convite pendente",
+ "es": "No hay invitaciones pendientes",
+ "ar": "لا توجد دعوات معلقة",
+ "fr": "Aucune invitation en attente",
+ "tr": "Bekleyen davet yok",
+ "de": "Keine ausstehenden Einladungen",
+ "uk": "Немає очікуваних запрошень",
+ "ca": "No hi ha invitacions pendents"
+ },
+ "ORG$REVOKE_INVITATION": {
+ "ar": "إلغاء الدعوة",
+ "ca": "Revoca la invitació",
+ "de": "Einladung widerrufen",
+ "en": "Revoke invitation",
+ "es": "Revocar invitación",
+ "fr": "Révoquer l'invitation",
+ "it": "Revoca invito",
+ "ja": "招待を取り消す",
+ "ko-KR": "초대 취소",
+ "no": "Trekk tilbake invitasjonen",
+ "pt": "Revogar convite",
+ "tr": "Daveti iptal et",
+ "uk": "Відкликати запрошення",
+ "zh-CN": "撤销邀请",
+ "zh-TW": "撤銷邀請"
+ },
+ "ORG$INVITATION_REVOKED": {
+ "ar": "تم إلغاء الدعوة",
+ "ca": "Invitació revocada",
+ "de": "Einladung widerrufen",
+ "en": "Invitation revoked",
+ "es": "Invitación revocada",
+ "fr": "Invitation révoquée",
+ "it": "Invito revocato",
+ "ja": "招待を取り消しました",
+ "ko-KR": "초대가 취소되었습니다",
+ "no": "Invitasjonen er trukket tilbake",
+ "pt": "Convite revogado",
+ "tr": "Davet iptal edildi",
+ "uk": "Запрошення відкликано",
+ "zh-CN": "邀请已撤销",
+ "zh-TW": "邀請已撤銷"
+ },
+ "ORG$INVITATION_REVOKE_ERROR": {
+ "ar": "فشل إلغاء الدعوة",
+ "ca": "No s'ha pogut revocar la invitació",
+ "de": "Einladung konnte nicht widerrufen werden",
+ "en": "Failed to revoke invitation",
+ "es": "No se pudo revocar la invitación",
+ "fr": "Échec de la révocation de l'invitation",
+ "it": "Impossibile revocare l'invito",
+ "ja": "招待の取り消しに失敗しました",
+ "ko-KR": "초대 취소에 실패했습니다",
+ "no": "Kunne ikke trekke tilbake invitasjonen",
+ "pt": "Falha ao revogar o convite",
+ "tr": "Davet iptal edilemedi",
+ "uk": "Не вдалося відкликати запрошення",
+ "zh-CN": "撤销邀请失败",
+ "zh-TW": "撤銷邀請失敗"
+ },
+ "ORG$AUTO_ADD_ENABLED_HINT": {
+ "ar": "ينضم المستخدمون الجدد إلى هذه المنظمة تلقائيًا عند تسجيل الدخول. الدعوات مفيدة فقط لتعيين دور مسبقًا.",
+ "ca": "Els usuaris nous s'uneixen a aquesta organització automàticament quan inicien sessió. Les invitacions només calen per assignar un rol per endavant.",
+ "de": "Neue Benutzer treten dieser Organisation beim Anmelden automatisch bei. Einladungen sind nur nötig, um vorab eine Rolle zuzuweisen.",
+ "en": "New users join this organization automatically when they sign in. Invitations are only needed to pre-assign a role.",
+ "es": "Los usuarios nuevos se unen a esta organización automáticamente al iniciar sesión. Las invitaciones solo sirven para asignar un rol por adelantado.",
+ "fr": "Les nouveaux utilisateurs rejoignent automatiquement cette organisation lors de leur connexion. Les invitations ne servent qu'à pré-assigner un rôle.",
+ "it": "I nuovi utenti si uniscono automaticamente a questa organizzazione al primo accesso. Gli inviti servono solo per pre-assegnare un ruolo.",
+ "ja": "新しいユーザーはサインイン時に自動的にこの組織に参加します。招待はロールを事前に割り当てる場合にのみ必要です。",
+ "ko-KR": "새 사용자는 로그인 시 자동으로 이 조직에 가입됩니다. 초대는 역할을 미리 지정할 때만 필요합니다.",
+ "no": "Nye brukere blir automatisk med i denne organisasjonen når de logger inn. Invitasjoner trengs bare for å forhåndstildele en rolle.",
+ "pt": "Novos usuários entram nesta organização automaticamente ao fazer login. Convites são necessários apenas para pré-atribuir uma função.",
+ "tr": "Yeni kullanıcılar oturum açtıklarında bu kuruluşa otomatik olarak katılır. Davetler yalnızca önceden rol atamak için gereklidir.",
+ "uk": "Нові користувачі автоматично приєднуються до цієї організації під час входу. Запрошення потрібні лише для попереднього призначення ролі.",
+ "zh-CN": "新用户登录后会自动加入此组织。仅在需要预先分配角色时才需要邀请。",
+ "zh-TW": "新使用者登入後會自動加入此組織。僅在需要預先指派角色時才需要邀請。"
+ },
+ "ORG$COPY_INVITE_LINK": {
+ "ar": "نسخ رابط الدعوة",
+ "ca": "Copia l'enllaç d'invitació",
+ "de": "Einladungslink kopieren",
+ "en": "Copy invite",
+ "es": "Copiar invitación",
+ "fr": "Copier l'invitation",
+ "it": "Copia invito",
+ "ja": "招待リンクをコピー",
+ "ko-KR": "초대 링크 복사",
+ "no": "Kopier invitasjon",
+ "pt": "Copiar convite",
+ "tr": "Daveti kopyala",
+ "uk": "Копіювати запрошення",
+ "zh-CN": "复制邀请链接",
+ "zh-TW": "複製邀請連結"
+ },
+ "ORG$INVITE_LINK_COPIED": {
+ "ar": "تم نسخ رابط الدعوة",
+ "ca": "Enllaç d'invitació copiat",
+ "de": "Einladungslink kopiert",
+ "en": "Invite copied",
+ "es": "Invitación copiada",
+ "fr": "Invitation copiée",
+ "it": "Invito copiato",
+ "ja": "招待リンクをコピーしました",
+ "ko-KR": "초대 링크가 복사되었습니다",
+ "no": "Invitasjon kopiert",
+ "pt": "Convite copiado",
+ "tr": "Davet kopyalandı",
+ "uk": "Запрошення скопійовано",
+ "zh-CN": "邀请链接已复制",
+ "zh-TW": "邀請連結已複製"
}
}
diff --git a/frontend/src/mocks/org-handlers.ts b/frontend/src/mocks/org-handlers.ts
index 05597a5285..800bc50b06 100644
--- a/frontend/src/mocks/org-handlers.ts
+++ b/frontend/src/mocks/org-handlers.ts
@@ -564,7 +564,26 @@ export const ORG_HANDLERS = [
ORGS_AND_MEMBERS[orgId] = [...members, ...newMembers];
- return HttpResponse.json(newMembers, { status: 201 });
+ return HttpResponse.json(
+ {
+ successful: emails.map((email, index) => ({
+ id: index + 1,
+ email,
+ role: "member",
+ status: "pending",
+ created_at: "2026-01-01T00:00:00Z",
+ expires_at: "2026-01-08T00:00:00Z",
+ invite_url: `https://app.example.com/api/organizations/members/invite/accept?token=inv-token-${index + 1}`,
+ })),
+ failed: [],
+ email_delivery_configured: true,
+ },
+ { status: 201 },
+ );
},
),
+
+ http.get("/api/organizations/:orgId/members/invite", () =>
+ HttpResponse.json({ items: [], email_delivery_configured: true }),
+ ),
];
diff --git a/frontend/src/routes/manage-organization-members.tsx b/frontend/src/routes/manage-organization-members.tsx
index 1561c289ba..524c23a764 100644
--- a/frontend/src/routes/manage-organization-members.tsx
+++ b/frontend/src/routes/manage-organization-members.tsx
@@ -9,6 +9,9 @@ import { useOrganizationMembers } from "#/hooks/query/use-organization-members";
import { useOrganizationMembersCount } from "#/hooks/query/use-organization-members-count";
import { OrganizationMember, OrganizationUserRole } from "#/types/org";
import { OrganizationMemberListItem } from "#/components/features/org/organization-member-list-item";
+import { PendingInvitationListItem } from "#/components/features/org/pending-invitation-list-item";
+import { usePendingInvitations } from "#/hooks/query/use-pending-invitations";
+import { useRevokeInvitation } from "#/hooks/mutation/use-revoke-invitation";
import { useUpdateMemberRole } from "#/hooks/mutation/use-update-member-role";
import { useRemoveMember } from "#/hooks/mutation/use-remove-member";
import { useMe } from "#/hooks/query/use-me";
@@ -78,6 +81,19 @@ function ManageOrganizationMembers() {
const { hasPermission } = usePermission(currentUserRole);
const hasPermissionToInvite = hasPermission("invite_user_to_organization");
+ // Pending invitations render as rows in the members list (with an
+ // "Invited" chip); the backing endpoint is invite-permission gated.
+ const { data: pendingData } = usePendingInvitations(hasPermissionToInvite);
+ const { mutate: revokeInvitation, isPending: isRevokingInvitation } =
+ useRevokeInvitation();
+ const pendingInvitations = (pendingData?.items ?? []).filter(
+ (invitation) =>
+ !debouncedEmailFilter ||
+ invitation.email
+ .toLowerCase()
+ .includes(debouncedEmailFilter.toLowerCase()),
+ );
+
// Calculate total pages
const totalPages =
totalCount !== undefined ? Math.ceil(totalCount / limit) : 0;
@@ -223,8 +239,28 @@ function ManageOrganizationMembers() {
</ul>
)}
+ {!isLoading && !hasError && pendingInvitations.length > 0 && (
+ <ul data-testid="pending-invitations-rows">
+ {pendingInvitations.map((invitation) => (
+ <li
+ key={`invitation-${invitation.id}`}
+ className="border-b border-org-divider last:border-none px-6"
+ >
+ <PendingInvitationListItem
+ invitation={invitation}
+ isRevoking={isRevokingInvitation}
+ onRevoke={() =>
+ revokeInvitation({ invitationId: invitation.id })
+ }
+ />
+ </li>
+ ))}
+ </ul>
+ )}
+
{!isLoading &&
!hasError &&
+ pendingInvitations.length === 0 &&
(!membersData?.items || membersData.items.length === 0) && (
<div className="flex items-center justify-center p-8 text-tertiary-alt">
{debouncedEmailFilter
diff --git a/frontend/src/types/org.ts b/frontend/src/types/org.ts
index 5b0af4fc46..ef6c1507d0 100644
--- a/frontend/src/types/org.ts
+++ b/frontend/src/types/org.ts
@@ -42,6 +42,32 @@ export interface OrganizationMembersPage {
per_page: number;
}
+export interface OrganizationInvitation {
+ id: number;
+ email: string;
+ role: string;
+ status: string;
+ created_at: string;
+ expires_at: string;
+ inviter_email?: string | null;
+ /** Acceptance link; only returned by admin/owner-gated endpoints. */
+ invite_url?: string | null;
+}
+
+export interface BatchInvitationResult {
+ successful: OrganizationInvitation[];
+ failed: { email: string; error: string }[];
+ /** False when the instance has no email provider configured. */
+ email_delivery_configured: boolean;
+}
+
+export interface PendingInvitationsPage {
+ items: OrganizationInvitation[];
+ email_delivery_configured: boolean;
+ /** Sign-in alone already adds users to this org; invites only pre-assign roles. */
+ auto_add_enabled: boolean;
+}
+
/** org_id and user_id are provided via URL params */
export type UpdateOrganizationMemberParams = Partial<
Omit<OrganizationMember, "org_id" | "user_id">