⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
feat: team invites are emailed and can be sent again (#555)
Pasqual Troncone0768828b106b
diff --git a/apps/api/AGENTS.md b/apps/api/AGENTS.mdindex e5f59d9f..302bbd58 100644--- a/apps/api/AGENTS.md+++ b/apps/api/AGENTS.md@@ -164,7 +164,9 @@ Enforced declaratively through macros, never imperative calls in handlers.workspace owner's (see SCIM below).- **A member of the team joins a project directly** (`POST /projects/:key/members`,from the candidate list); anyone else joins through an invite, which puts them in- the team as well. A team invite (`/teams/:teamId/invites`) names no project. One+ the team as well. A team invite (`/teams/:teamId/invites`) names no project, so its+ email cannot go through the notification outbox, which belongs to a project:+ `invites/email.ts` sends it at once, without the outbox's retries. Onepending invite per (team, email) and per (project, email) — partial unique indexes →409, and so is an address already in the team or in the project: accepting such aninvite would rewrite the membership it already holds, demoting an owner past thediff --git a/apps/api/src/__tests__/integration/invite-forms.test.ts b/apps/api/src/__tests__/integration/invite-forms.test.tsindex 84b6709d..ff96ee07 100644--- a/apps/api/src/__tests__/integration/invite-forms.test.ts+++ b/apps/api/src/__tests__/integration/invite-forms.test.ts@@ -135,6 +135,7 @@ describe('invites over an API key', () => {const created = await asKey.invites.post({ email: '[email protected]', role: 'member' });expect(created.status).toBe(201);+ expect(created.data!.emailFailed).toBe(false);await db.update(teamInvite).set({ createdAt: new Date(Date.now() - 8 * DAY) })diff --git a/apps/api/src/modules/invites/__tests__/integration/invite-expiry.test.ts b/apps/api/src/modules/invites/__tests__/integration/invite-expiry.test.tsindex 7a04cc29..1599223d 100644--- a/apps/api/src/modules/invites/__tests__/integration/invite-expiry.test.ts+++ b/apps/api/src/modules/invites/__tests__/integration/invite-expiry.test.ts@@ -18,6 +18,26 @@ async function setup() {const project = (api: Api) => api.projects({ projectKey: 'MKT' });+// A mail provider is set, but nothing listens on its port: every send fails.+async function failingProvider(api: Api) {+ const closed = Bun.listen({ hostname: '127.0.0.1', port: 0, socket: { data() {} } });+ const port = closed.port;+ closed.stop(true);+ const configured = await api.god['email-settings'].put({+ from: 'Test <[email protected]>',+ smtp: {+ enabled: true,+ host: '127.0.0.1',+ port,+ encryption: 'none',+ username: '',+ timeout: 2,+ },+ allowProjects: false,+ });+ expect(configured.status).toBe(200);+}+async function backdate(token: string, days: number) {await db.update(teamInvite)@@ -226,9 +246,9 @@ describe('renewing an expired invite', () => {.invites({ inviteId: old.data!.id }).renew.post();expect(renewed.status).toBe(201);+ // No provider here: nothing was sent, and nothing failed.+ expect(renewed.data).toMatchObject({ emailQueued: false, emailFailed: false });expect(renewed.data!.token).not.toBe(old.data!.token);- // A team invite has no email of its own: its new link is returned to share.- expect(renewed.data!.emailQueued).toBe(false);const pending = (await asOwner.teams({ teamId }).invites.get()).data!.filter((i) => i.status === 'pending',);@@ -343,3 +363,125 @@ describe('invite lifetime setting', () => {expect((await asGod.god['auth-settings'].put({ inviteTtlDays: 30 })).status).toBe(200);});});++// A team invite that is still valid can be mailed again, the same link; an expired one+// is renewed instead.+describe('mailing a team invite again', () => {+ beforeEach(resetDb);++ it('mails a valid team invite and a project invite of the team', async () => {+ const { asOwner, teamId } = await setup();+ const team = await asOwner+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });+ const proj = await project(asOwner).invites.post({+ email: '[email protected]',+ role: 'member',+ });++ for (const id of [team.data!.id, proj.data!.id]) {+ const sent = await asOwner.teams({ teamId }).invites({ inviteId: id }).email.post();+ expect(sent.status).toBe(200);+ // The test instance has no mail provider, so nothing goes out and the caller is told.+ expect(sent.data).toEqual({ emailQueued: false });+ }+ });++ it('refuses to mail an expired team invite', async () => {+ const { asOwner, teamId } = await setup();+ const team = await asOwner+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });+ await backdate(team.data!.token, 8);++ const sent = await asOwner.teams({ teamId }).invites({ inviteId: team.data!.id }).email.post();+ expect(sent.status).toBe(409);+ });++ it('does not mail an invite of another team', async () => {+ const { asOwner, teamId } = await setup();+ const other = await signUpTestUser({ name: 'Other owner' });+ const asOther = authedApi(other.cookie);+ const otherTeamId = (await createProject(asOther, { key: 'OPS', name: 'Ops' })).data!.teamId;+ const foreign = await asOther+ .teams({ teamId: otherTeamId })+ .invites.post({ email: '[email protected]', role: 'member' });++ const sent = await asOwner+ .teams({ teamId })+ .invites({ inviteId: foreign.data!.id })+ .email.post();+ expect(sent.status).toBe(404);+ });++ it('leaves mailing team invites to whoever runs the team', async () => {+ const { asOwner, teamId } = await setup();+ const member = await signUpTestUser({ team: false });+ const join = await asOwner+ .teams({ teamId })+ .invites.post({ email: member.email, role: 'member' });+ const asMember = authedApi(member.cookie);+ await asMember.invites({ token: join.data!.token }).accept.post();+ const other = await asOwner+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });++ const sent = await asMember+ .teams({ teamId })+ .invites({ inviteId: other.data!.id })+ .email.post();+ expect(sent.status).toBe(403);+ });++ it('reports a failed send as an error, not as a missing provider', async () => {+ const { asOwner, teamId } = await setup();+ await failingProvider(asOwner);+ const team = await asOwner+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });++ const sent = await asOwner.teams({ teamId }).invites({ inviteId: team.data!.id }).email.post();+ expect(sent.status).toBe(502);+ });+});++// A failed email is told apart from a missing provider when an invite is created or+// renewed: the invite stands, and the person is not sent looking for a configuration.+describe('reporting an invite email that could not be sent', () => {+ beforeEach(resetDb);++ it('creates a team invite and reports its failed email', async () => {+ const { asOwner, teamId } = await setup();+ await failingProvider(asOwner);++ const created = await asOwner+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });+ expect(created.status).toBe(201);+ expect(created.data).toMatchObject({ emailQueued: false, emailFailed: true });+ });++ it('renews an expired team invite and reports its failed email', async () => {+ const { asOwner, teamId } = await setup();+ const old = await asOwner+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });+ await backdate(old.data!.token, 8);+ await failingProvider(asOwner);++ const renewed = await asOwner+ .teams({ teamId })+ .invites({ inviteId: old.data!.id })+ .renew.post();+ expect(renewed.status).toBe(201);+ expect(renewed.data).toMatchObject({ emailQueued: false, emailFailed: true });+ });++ it('reports no failure where there is no provider at all', async () => {+ const { asOwner, teamId } = await setup();+ const created = await asOwner+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });+ expect(created.data).toMatchObject({ emailQueued: false, emailFailed: false });+ });+});diff --git a/apps/api/src/modules/invites/__tests__/integration/invites.test.ts b/apps/api/src/modules/invites/__tests__/integration/invites.test.tsindex e9281b57..5dda1547 100644--- a/apps/api/src/modules/invites/__tests__/integration/invites.test.ts+++ b/apps/api/src/modules/invites/__tests__/integration/invites.test.ts@@ -1,4 +1,4 @@-import { describe, it, expect, afterEach, beforeEach } from 'bun:test';+import { describe, it, expect, afterAll, afterEach, beforeAll, beforeEach } from 'bun:test';import { authedApi, createProject } from '#tests/helpers/app';import { signUpTestUser, type TestUser } from '#tests/helpers/auth';import { resetDb } from '#tests/helpers/db';@@ -180,6 +180,98 @@ describe('invites', () => {});});+ // A team invite names no project, so it cannot go through the notification outbox,+ // which belongs to one: it only created a link to copy, and nobody was told.+ describe('team invite email — POST /teams/:teamId/invites', () => {+ let smtp: Bun.TCPSocketListener<{ data: boolean }>;+ let received: { to: string[]; body: string }[] = [];++ beforeAll(() => {+ smtp = Bun.listen<{ data: boolean }>({+ hostname: '127.0.0.1',+ port: 0,+ socket: {+ open(socket) {+ socket.data = { data: false };+ received.push({ to: [], body: '' });+ socket.write('220 fake ESMTP\r\n');+ },+ data(socket, chunk) {+ const message = received[received.length - 1]!;+ for (const line of chunk.toString().split('\r\n')) {+ if (socket.data.data) {+ if (line === '.') {+ socket.data.data = false;+ socket.write('250 queued\r\n');+ } else message.body += line + '\n';+ continue;+ }+ if (!line) continue;+ const command = line.split(' ')[0]!.toUpperCase();+ if (command === 'EHLO') socket.write('250 fake\r\n');+ else if (command === 'RCPT') {+ message.to.push(line);+ socket.write('250 ok\r\n');+ } else if (command === 'DATA') {+ socket.data.data = true;+ socket.write('354 go ahead\r\n');+ } else if (command === 'QUIT') {+ socket.write('221 bye\r\n');+ socket.end();+ } else socket.write('250 ok\r\n');+ }+ },+ },+ });+ });++ afterAll(() => smtp.stop(true));++ beforeEach(() => {+ received = [];+ });++ it('emails the invite link through the instance provider', async () => {+ const owner = await setupOwner();+ const configured = await owner.api.god['email-settings'].put({+ from: 'Test <[email protected]>',+ smtp: {+ enabled: true,+ host: '127.0.0.1',+ port: smtp.port,+ encryption: 'none',+ username: '',+ timeout: 5,+ },+ allowProjects: false,+ });+ expect(configured.status).toBe(200);+ const teamId = await ownTeamId(owner.api);++ const res = await owner.api+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });++ expect(res.status).toBe(201);+ expect(res.data?.emailQueued).toBe(true);+ const sent = received.find((m) => m.to.some((to) => to.includes('[email protected]')));+ expect(sent?.body).toContain(`/invite/${res.data!.token}`);+ });++ it('still creates the link when no email provider is configured', async () => {+ const owner = await setupOwner();+ const teamId = await ownTeamId(owner.api);++ const res = await owner.api+ .teams({ teamId })+ .invites.post({ email: '[email protected]', role: 'member' });++ expect(res.status).toBe(201);+ expect(res.data?.emailQueued).toBe(false);+ expect(res.data?.token.length).toBeGreaterThan(0);+ });+ });+describe('email — POST /projects/:projectKey/invites/:inviteId/email', () => {it('reports that email is unavailable without blocking the invite', async () => {const owner = await setupOwner();diff --git a/apps/api/src/modules/invites/email.ts b/apps/api/src/modules/invites/email.tsindex 38a985c3..d38d54b7 100644--- a/apps/api/src/modules/invites/email.ts+++ b/apps/api/src/modules/invites/email.ts@@ -1,11 +1,11 @@import { randomUUID } from 'node:crypto';-import { db, notificationDelivery, getInstanceEmailConfig } from '@repo/db';+import { db, notificationDelivery, getInstanceEmailConfig, team } from '@repo/db';import { trustedOrigins } from '@repo/auth';-import { hasEmailProvider } from '@repo/mailer';+import { emailBody, hasEmailProvider, sendEmail } from '@repo/mailer';import { and, eq, sql } from 'drizzle-orm';import type { InviteRow } from './service';-export interface InviteProject {+interface InviteProject {id: number;name: string;}@@ -67,3 +67,29 @@ export async function enqueueInviteEmail(});return true;}++// A team invite names no project, and the notification outbox belongs to one, so it+// cannot be queued there. It is sent at once instead, as the sign-in emails are:+// best effort, without the outbox's retries. A failure leaves the link to be copied.+export async function sendTeamInviteEmail(teamId: number, invite: InviteRow): Promise<boolean> {+ const config = await getInstanceEmailConfig();+ if (!config || !hasEmailProvider(config)) return false;++ const [row] = await db.select({ name: team.name }).from(team).where(eq(team.id, teamId));+ const teamName = (row?.name ?? 'a team').replace(/[\r\n]+/g, ' ');+ const inviter = invite.invitedByName ?? invite.invitedByEmail ?? "An It's a Plan user";+ const { text, html } = emailBody(+ `${inviter} invited you to join the team ${teamName} as ${invite.teamRole}.\n\n` ++ 'Open the invitation to sign in or create an account. ' ++ 'If you did not expect this invitation, you can ignore this email.',+ `${trustedOrigins[0]}/invite/${invite.token}`,+ );+ const result = await sendEmail(config, {+ to: invite.email,+ subject: `You were invited to ${teamName} on It's a Plan`,+ text,+ html,+ });+ if (!result.ok) console.error('[invites] team invite email failed:', result.error);+ return result.ok;+}diff --git a/apps/api/src/modules/invites/index.ts b/apps/api/src/modules/invites/index.tsindex ef8e5681..8435355c 100644--- a/apps/api/src/modules/invites/index.ts+++ b/apps/api/src/modules/invites/index.ts@@ -5,6 +5,7 @@ import { authContext } from '#shared/auth-context';import { guards } from '#shared/guards';import { requireUser, type AuthUser } from '#shared/access';import { inviteValidSince } from '@repo/auth';+import { hasConfiguredEmailProvider } from '@repo/db';import { HttpError } from '#shared/lib';import { accessErrors, commonErrors, errors } from '#shared/responses';import { getRole } from '#modules/roles/service';@@ -14,7 +15,6 @@ import {InviteCreateResponse,InviteEmailResponse,InviteRowListResponse,- InviteRowResponse,InviteViewResponse,createInviteBody,createTeamInviteBody,@@ -36,9 +36,8 @@ import {renewInvite,acceptInvite,rejectInvite,- type InviteRow,} from './service';-import { enqueueInviteEmail, type InviteProject } from './email';+import { enqueueInviteEmail, sendTeamInviteEmail } from './email';// Shared by accept and reject: an invite is actionable only by the account whose// email it names, and only while it is still pending.@@ -73,14 +72,17 @@ async function assertStillGrantable(invite: {}}-// Creating or renewing the invite link is the primary operation. A transient outbox-// failure must not discard a valid link that can still be copied.-async function queueEmail(project: InviteProject, invite: InviteRow): Promise<boolean> {+// What a created or renewed invite reports about its email. Without a provider nothing+// was sent and the link is to be shared by hand; a provider whose send fails is told+// apart, so nobody goes looking for a missing configuration.+async function mailOutcome(send: () => Promise<boolean>) {+ if (!(await hasConfiguredEmailProvider())) return { emailQueued: false, emailFailed: false };try {- return await enqueueInviteEmail(project, invite);+ const sent = await send();+ return { emailQueued: sent, emailFailed: !sent };} catch (err) {- console.error('[invites] email enqueue failed:', err);- return false;+ console.error('[invites] invite email failed:', err);+ return { emailQueued: false, emailFailed: true };}}@@ -130,9 +132,11 @@ export const inviteRoutes = new Elysia({ name: 'invites', detail: { tags: ['InviroleId,invitedByUserId: invitedBy,});- const emailQueued = await queueEmail(project, invite);+ // Creating the invite link is the primary operation: a failed email must not+ // discard a valid link that can still be copied.+ const email = await mailOutcome(() => enqueueInviteEmail(project, invite));set.status = 201;- return { ...invite, emailQueued };+ return { ...invite, ...email };},{body: createInviteBody,@@ -143,7 +147,8 @@ export const inviteRoutes = new Elysia({ name: 'invites', detail: { tags: ['Invidescription:'Create an invite link for an email and role (owner or member). For a member, roleId ' +"picks the custom role, or null for the default role. Accepting it joins the project's " +- 'team as well. Queues an email when the instance email provider is configured.',+ 'team as well. Queues an email when the instance email provider is configured; ' ++ 'emailFailed reports an email the provider could not send, the link still valid.',...mcpTool('create_invite'),},},@@ -193,9 +198,9 @@ export const inviteRoutes = new Elysia({ name: 'invites', detail: { tags: ['Invi);}const invite = await renewInvite(grant, renewedBy);- const emailQueued = await queueEmail(project, invite);+ const email = await mailOutcome(() => enqueueInviteEmail(project, invite));set.status = 201;- return { ...invite, emailQueued };+ return { ...invite, ...email };},{params: inviteParams,@@ -265,19 +270,23 @@ export const inviteRoutes = new Elysia({ name: 'invites', detail: { tags: ['InviroleId: null,invitedByUserId: membership.userId,});+ // As for a project invite: the link is the primary result and stays valid.+ const email = await mailOutcome(() => sendTeamInviteEmail(membership.teamId, invite));set.status = 201;- return invite;+ return { ...invite, ...email };},{teamManager: true,params: teamParams,body: createTeamInviteBody,- response: { 201: InviteRowResponse, ...errors(400, 401, 403, 404, 409) },+ response: { 201: InviteCreateResponse, ...errors(400, 401, 403, 404, 409) },detail: {summary: 'Invite someone to a team',description:'Create an invite link into the team, as a member, a manager or an owner. Only an ' +- 'owner can invite a manager or another owner.',+ 'owner can invite a manager or another owner. Emails the link when the instance ' ++ 'email provider is configured; emailFailed reports an email the provider could not ' ++ 'send, the link still valid.',},},)@@ -299,8 +308,57 @@ export const inviteRoutes = new Elysia({ name: 'invites', detail: { tags: ['Invi},)+ // The team list also shows the invites that name one of its projects, so this mails+ // those too, as their project would.+ .post(+ '/teams/:teamId/invites/:inviteId/email',+ async ({ membership, params }) => {+ const grant = await getInviteGrant(params.inviteId);+ if (!grant || grant.teamId !== membership.teamId) {+ throw new HttpError(404, 'Invite not found');+ }+ const invite = await getInviteById(params.inviteId);+ if (!invite) throw new HttpError(404, 'Invite not found');+ if (invite.status !== 'pending') {+ throw new HttpError(409, 'This invite is no longer pending');+ }+ if (invite.expiresAt && new Date(invite.expiresAt) < new Date()) {+ throw new HttpError(409, 'This invite has expired. Renew it to send a new link.');+ }+ // Without a provider there is nothing to send, and the caller is told to share the+ // link; a provider that fails is an error, not that.+ if (!(await hasConfiguredEmailProvider())) return { emailQueued: false };+ if (grant.projectId == null) {+ if (!(await sendTeamInviteEmail(membership.teamId, invite))) {+ throw new HttpError(502, 'The invite email could not be sent');+ }+ return { emailQueued: true };+ }+ if (invite.projectName == null) return { emailQueued: false };+ return {+ emailQueued: await enqueueInviteEmail(+ { id: grant.projectId, name: invite.projectName },+ invite,+ ),+ };+ },+ {+ teamManager: true,+ params: teamInviteParams,+ response: { 200: InviteEmailResponse, ...errors(401, 403, 404, 409, 502) },+ detail: {+ summary: 'Send an invite email of the team',+ description:+ 'Email a pending invite into the team, or into one of its projects, again: the same ' ++ 'link. Returns false when the instance email provider is not configured, and 502 when ' ++ 'it is configured but the email to the team alone could not be sent. An expired ' ++ 'invite is refused: renew it instead.',+ },+ },+ )+// The team list also shows the invites that name one of its projects, so this renews- // those too, queueing their email as their project would. A team invite has no email.+ // those too, mailing them as their project would..post('/teams/:teamId/invites/:inviteId/renew',async ({ membership, params, set }) => {@@ -314,12 +372,13 @@ export const inviteRoutes = new Elysia({ name: 'invites', detail: { tags: ['Inviconst invite = await renewInvite(grant, membership.userId);const { projectId } = grant;const projectName = invite.projectName;- const emailQueued =- projectId != null && projectName != null- ? await queueEmail({ id: projectId, name: projectName }, invite)- : false;+ const email = await mailOutcome(async () => {+ if (projectId == null) return sendTeamInviteEmail(membership.teamId, invite);+ if (projectName == null) return false;+ return enqueueInviteEmail({ id: projectId, name: projectName }, invite);+ });set.status = 201;- return { ...invite, emailQueued };+ return { ...invite, ...email };},{teamManager: true,@@ -330,8 +389,7 @@ export const inviteRoutes = new Elysia({ name: 'invites', detail: { tags: ['Invidescription:'Replace an expired invite into the team, or into one of its projects, with a new one ' +'for the same email and rank: a new link, valid again for the instance invite ' +- 'lifetime. Queues the email of a project invite when the instance email provider is ' +- 'configured; a team invite returns its link to share.',+ 'lifetime. Emails it when the instance email provider is configured.',},},)diff --git a/apps/api/src/modules/invites/model.ts b/apps/api/src/modules/invites/model.tsindex 2702166e..5690ec80 100644--- a/apps/api/src/modules/invites/model.ts+++ b/apps/api/src/modules/invites/model.ts@@ -44,9 +44,11 @@ export const InviteRowResponse = t.Object({invitedByEmail: t.Nullable(t.String()),});+// emailFailed: a mail provider is set but the invite's email could not go out; the link+// still works. Without a provider both are false.export const InviteCreateResponse = t.Composite([InviteRowResponse,- t.Object({ emailQueued: t.Boolean() }),+ t.Object({ emailQueued: t.Boolean(), emailFailed: t.Boolean() }),]);export const InviteEmailResponse = t.Object({ emailQueued: t.Boolean() });diff --git a/apps/web/messages/ar/members.json b/apps/web/messages/ar/members.jsonindex 6e2804df..e9deef40 100644--- a/apps/web/messages/ar/members.json+++ b/apps/web/messages/ar/members.json@@ -58,6 +58,7 @@"copied": "تم النسخ","emailQueued": "اتضاف إيميل الدعوة لطابور الإرسال","emailUnavailable": "الدعوة اتعملت، بس الإيميل ماتضافش لطابور الإرسال. انسخ الرابط وشاركه.",+ "emailFailed": "أُنشئت الدعوة، لكن تعذّر إرسال البريد الإلكتروني. انسخ الرابط لمشاركته.","resendUnavailable": "البريد الإلكتروني غير مهيأ. انسخ رابط الدعوة وشاركه.","resendEmail": "إرسال إيميل","resendingEmail": "جارٍ الإضافة…",@@ -65,7 +66,7 @@"renewing": "جارٍ التجديد…","renewed": "تم تجديد الدعوة: أُرسل رابط جديد بالبريد الإلكتروني","renewedNoEmail": "تم تجديد الدعوة. البريد الإلكتروني غير مُعدّ: انسخ الرابط الجديد لمشاركته.",- "renewedCopyLink": "تم تجديد الدعوة. انسخ الرابط الجديد لمشاركته.",+ "renewedEmailFailed": "تم تجديد الدعوة، لكن تعذّر إرسال البريد الإلكتروني. انسخ الرابط الجديد لمشاركته.","revokeAction": "إلغاء الدعوة","removeAction": "إزالة الدعوة","invitedBy": "بدعوة من {name} · ",diff --git a/apps/web/messages/ar/teams.json b/apps/web/messages/ar/teams.jsonindex 7c963266..15fe57f6 100644--- a/apps/web/messages/ar/teams.json+++ b/apps/web/messages/ar/teams.json@@ -108,6 +108,8 @@"joinsProject": "هيدخل الفريق و{project}","copyLink": "نسخ الرابط","copied": "تم النسخ",+ "resendEmail": "إرسال بريد إلكتروني",+ "resendingEmail": "جارٍ الإرسال…","revokeAction": "إلغاء الدعوة","revokeTitle": "إلغاء دعوة {email}؟","revokeConfirm": "إلغاء الدعوة",diff --git a/apps/web/messages/en/members.json b/apps/web/messages/en/members.jsonindex 3b17d430..6b7e73c4 100644--- a/apps/web/messages/en/members.json+++ b/apps/web/messages/en/members.json@@ -58,6 +58,7 @@"copied": "Copied","emailQueued": "Invitation email queued","emailUnavailable": "Invite created, but email was not queued. Copy the link to share it.",+ "emailFailed": "The invite was created, but its email could not be sent. Copy the link to share it.","resendUnavailable": "Email is not configured. Copy the invitation link to share it.","resendEmail": "Send email","resendingEmail": "Queueing…",@@ -65,7 +66,7 @@"renewing": "Renewing…","renewed": "Invite renewed: a new link was emailed","renewedNoEmail": "Invite renewed. Email is not configured: copy the new link to share it.",- "renewedCopyLink": "Invite renewed. Copy the new link to share it.",+ "renewedEmailFailed": "Invite renewed, but its email could not be sent. Copy the new link to share it.","revokeAction": "Revoke invite","removeAction": "Remove invite","invitedBy": "Invited by {name} · ",diff --git a/apps/web/messages/en/teams.json b/apps/web/messages/en/teams.jsonindex d7af164f..2a6889ad 100644--- a/apps/web/messages/en/teams.json+++ b/apps/web/messages/en/teams.json@@ -108,6 +108,8 @@"joinsProject": "Joins the team and {project}","copyLink": "Copy link","copied": "Copied",+ "resendEmail": "Send email",+ "resendingEmail": "Sending…","revokeAction": "Revoke invite","revokeTitle": "Revoke invite for {email}?","revokeConfirm": "Revoke invite",diff --git a/apps/web/messages/es-ES/members.json b/apps/web/messages/es-ES/members.jsonindex 8ae02ba1..bf3cc2d9 100644--- a/apps/web/messages/es-ES/members.json+++ b/apps/web/messages/es-ES/members.json@@ -58,6 +58,7 @@"copied": "Copiado","emailQueued": "Correo de invitación en cola","emailUnavailable": "Invitación creada, pero el correo no se ha puesto en cola. Copia el enlace para compartirlo.",+ "emailFailed": "La invitación se ha creado, pero no se ha podido enviar el correo. Copia el enlace para compartirlo.","resendUnavailable": "El correo no está configurado. Copia el enlace de invitación para compartirlo.","resendEmail": "Enviar correo","resendingEmail": "Poniendo en cola…",@@ -65,7 +66,7 @@"renewing": "Renovando…","renewed": "Invitación renovada: se ha enviado un enlace nuevo por correo","renewedNoEmail": "Invitación renovada. El correo no está configurado: copia el enlace nuevo para compartirlo.",- "renewedCopyLink": "Invitación renovada. Copia el enlace nuevo para compartirlo.",+ "renewedEmailFailed": "Invitación renovada, pero no se ha podido enviar el correo. Copia el enlace nuevo para compartirlo.","revokeAction": "Revocar invitación","removeAction": "Quitar invitación","invitedBy": "Invitado por {name} · ",diff --git a/apps/web/messages/es-ES/teams.json b/apps/web/messages/es-ES/teams.jsonindex 8e5c47a3..bfdd1197 100644--- a/apps/web/messages/es-ES/teams.json+++ b/apps/web/messages/es-ES/teams.json@@ -108,6 +108,8 @@"joinsProject": "Se une al equipo y a {project}","copyLink": "Copiar el enlace","copied": "Copiado",+ "resendEmail": "Enviar correo",+ "resendingEmail": "Enviando…","revokeAction": "Revocar invitación","revokeTitle": "¿Revocar la invitación de {email}?","revokeConfirm": "Revocar invitación",diff --git a/apps/web/messages/fr/members.json b/apps/web/messages/fr/members.jsonindex 530298e9..de3bfc65 100644--- a/apps/web/messages/fr/members.json+++ b/apps/web/messages/fr/members.json@@ -58,6 +58,7 @@"copied": "Copié","emailQueued": "E-mail d'invitation mis en file d'attente","emailUnavailable": "Invitation créée, mais l'e-mail n'a pas été mis en file d'attente. Copiez le lien pour le partager.",+ "emailFailed": "L'invitation a été créée, mais l'e-mail n'a pas pu être envoyé. Copiez le lien pour le partager.","resendUnavailable": "L'e-mail n'est pas configuré. Copiez le lien d'invitation pour le partager.","resendEmail": "Envoyer l'e-mail","resendingEmail": "Mise en file d'attente…",@@ -65,7 +66,7 @@"renewing": "Renouvellement…","renewed": "Invitation renouvelée : un nouveau lien a été envoyé par e-mail","renewedNoEmail": "Invitation renouvelée. L'e-mail n'est pas configuré : copiez le nouveau lien pour le partager.",- "renewedCopyLink": "Invitation renouvelée. Copiez le nouveau lien pour le partager.",+ "renewedEmailFailed": "Invitation renouvelée, mais l'e-mail n'a pas pu être envoyé. Copiez le nouveau lien pour le partager.","revokeAction": "Révoquer l'invitation","removeAction": "Supprimer l'invitation","invitedBy": "Invité par {name} · ",diff --git a/apps/web/messages/fr/teams.json b/apps/web/messages/fr/teams.jsonindex 8e58d32b..8f72fdb4 100644--- a/apps/web/messages/fr/teams.json+++ b/apps/web/messages/fr/teams.json@@ -108,6 +108,8 @@"joinsProject": "Rejoint l'équipe et {project}","copyLink": "Copier le lien","copied": "Copié",+ "resendEmail": "Envoyer l'e-mail",+ "resendingEmail": "Envoi…","revokeAction": "Révoquer l'invitation","revokeTitle": "Révoquer l'invitation de {email} ?","revokeConfirm": "Révoquer l'invitation",diff --git a/apps/web/messages/id/members.json b/apps/web/messages/id/members.jsonindex f875374d..fc70aa77 100644--- a/apps/web/messages/id/members.json+++ b/apps/web/messages/id/members.json@@ -58,6 +58,7 @@"copied": "Disalin","emailQueued": "Email undangan dimasukkan ke antrean","emailUnavailable": "Undangan dibuat, tetapi email tidak dimasukkan ke antrean. Salin tautan untuk membagikannya.",+ "emailFailed": "Undangan dibuat, tetapi emailnya tidak dapat dikirim. Salin tautannya untuk membagikannya.","resendUnavailable": "Email tidak dikonfigurasi. Salin tautan undangan untuk membagikannya.","resendEmail": "Kirim email","resendingEmail": "Mengantrekan…",@@ -65,7 +66,7 @@"renewing": "Memperbarui…","renewed": "Undangan diperbarui: tautan baru telah dikirim lewat email","renewedNoEmail": "Undangan diperbarui. Email belum dikonfigurasi: salin tautan baru untuk membagikannya.",- "renewedCopyLink": "Undangan diperbarui. Salin tautan baru untuk membagikannya.",+ "renewedEmailFailed": "Undangan diperbarui, tetapi emailnya tidak dapat dikirim. Salin tautan baru untuk membagikannya.","revokeAction": "Cabut undangan","removeAction": "Hapus undangan","invitedBy": "Diundang oleh {name} · ",diff --git a/apps/web/messages/id/teams.json b/apps/web/messages/id/teams.jsonindex 7bc62669..db7a3d49 100644--- a/apps/web/messages/id/teams.json+++ b/apps/web/messages/id/teams.json@@ -108,6 +108,8 @@"joinsProject": "Bergabung ke tim dan {project}","copyLink": "Salin tautan","copied": "Disalin",+ "resendEmail": "Kirim email",+ "resendingEmail": "Mengirim…","revokeAction": "Cabut undangan","revokeTitle": "Cabut undangan untuk {email}?","revokeConfirm": "Cabut undangan",diff --git a/apps/web/messages/ko/members.json b/apps/web/messages/ko/members.jsonindex 4a70bf5e..6c1badf0 100644--- a/apps/web/messages/ko/members.json+++ b/apps/web/messages/ko/members.json@@ -58,6 +58,7 @@"copied": "복사됨","emailQueued": "초대 이메일이 전송 대기열에 추가되었습니다","emailUnavailable": "초대가 생성되었지만 이메일을 전송 대기열에 추가하지 못했습니다. 초대 링크를 복사하여 공유하세요.",+ "emailFailed": "초대가 생성되었지만 이메일을 보내지 못했습니다. 링크를 복사하여 공유하세요.","resendUnavailable": "이메일이 설정되어 있지 않습니다. 초대 링크를 복사하여 공유하세요.","resendEmail": "이메일 보내기","resendingEmail": "전송 대기열에 추가 중…",@@ -65,7 +66,7 @@"renewing": "갱신 중…","renewed": "초대가 갱신되었습니다. 새 링크를 이메일로 보냈습니다","renewedNoEmail": "초대가 갱신되었습니다. 이메일이 설정되어 있지 않습니다. 새 링크를 복사하여 공유하세요.",- "renewedCopyLink": "초대가 갱신되었습니다. 새 링크를 복사하여 공유하세요.",+ "renewedEmailFailed": "초대가 갱신되었지만 이메일을 보내지 못했습니다. 새 링크를 복사하여 공유하세요.","revokeAction": "초대 취소","removeAction": "초대 삭제","invitedBy": "{name}이(가) 초대 · ",diff --git a/apps/web/messages/ko/teams.json b/apps/web/messages/ko/teams.jsonindex cb725992..e159f8a8 100644--- a/apps/web/messages/ko/teams.json+++ b/apps/web/messages/ko/teams.json@@ -108,6 +108,8 @@"joinsProject": "팀 및 {project} 프로젝트에 참여","copyLink": "링크 복사","copied": "복사됨",+ "resendEmail": "이메일 보내기",+ "resendingEmail": "전송 중…","revokeAction": "초대 취소","revokeTitle": "{email} 초대를 취소하시겠습니까?","revokeConfirm": "초대 취소",diff --git a/apps/web/messages/pt-BR/members.json b/apps/web/messages/pt-BR/members.jsonindex 0a3b8bcf..8a35f991 100644--- a/apps/web/messages/pt-BR/members.json+++ b/apps/web/messages/pt-BR/members.json@@ -58,6 +58,7 @@"copied": "Copiado","emailQueued": "E-mail de convite na fila","emailUnavailable": "Convite criado, mas o e-mail não foi colocado na fila. Copie o link para compartilhá-lo.",+ "emailFailed": "O convite foi criado, mas não foi possível enviar o e-mail. Copie o link para compartilhá-lo.","resendUnavailable": "E-mail não está configurado. Copie o link do convite para compartilhá-lo.","resendEmail": "Enviar e-mail","resendingEmail": "Colocando na fila…",@@ -65,7 +66,7 @@"renewing": "Renovando…","renewed": "Convite renovado: um novo link foi enviado por e-mail","renewedNoEmail": "Convite renovado. O e-mail não está configurado: copie o novo link para compartilhá-lo.",- "renewedCopyLink": "Convite renovado. Copie o novo link para compartilhá-lo.",+ "renewedEmailFailed": "Convite renovado, mas não foi possível enviar o e-mail. Copie o novo link para compartilhá-lo.","revokeAction": "Revogar convite","removeAction": "Remover convite","invitedBy": "Convidado por {name} · ",diff --git a/apps/web/messages/pt-BR/teams.json b/apps/web/messages/pt-BR/teams.jsonindex d2318bd4..09f94dee 100644--- a/apps/web/messages/pt-BR/teams.json+++ b/apps/web/messages/pt-BR/teams.json@@ -108,6 +108,8 @@"joinsProject": "Entra no time e em {project}","copyLink": "Copiar link","copied": "Copiado",+ "resendEmail": "Enviar e-mail",+ "resendingEmail": "Enviando…","revokeAction": "Revogar convite","revokeTitle": "Revogar convite de {email}?","revokeConfirm": "Revogar convite",diff --git a/apps/web/messages/ru/members.json b/apps/web/messages/ru/members.jsonindex 397b5d64..5bb91c32 100644--- a/apps/web/messages/ru/members.json+++ b/apps/web/messages/ru/members.json@@ -58,6 +58,7 @@"copied": "Скопировано","emailQueued": "Письмо с приглашением поставлено в очередь","emailUnavailable": "Приглашение создано, но письмо не поставлено в очередь. Скопируйте ссылку.",+ "emailFailed": "Приглашение создано, но письмо отправить не удалось. Скопируйте ссылку, чтобы поделиться ею.","resendUnavailable": "Почта не настроена. Скопируйте ссылку на приглашение.","resendEmail": "Отправить письмо","resendingEmail": "В очередь…",@@ -65,7 +66,7 @@"renewing": "Обновление…","renewed": "Приглашение обновлено: новая ссылка отправлена по почте","renewedNoEmail": "Приглашение обновлено. Почта не настроена: скопируйте новую ссылку, чтобы поделиться ею.",- "renewedCopyLink": "Приглашение обновлено. Скопируйте новую ссылку, чтобы поделиться ею.",+ "renewedEmailFailed": "Приглашение обновлено, но письмо отправить не удалось. Скопируйте новую ссылку, чтобы поделиться ею.","revokeAction": "Отозвать приглашение","removeAction": "Убрать приглашение","invitedBy": "Пригласил {name} · ",diff --git a/apps/web/messages/ru/teams.json b/apps/web/messages/ru/teams.jsonindex d8d3828b..ea692262 100644--- a/apps/web/messages/ru/teams.json+++ b/apps/web/messages/ru/teams.json@@ -108,6 +108,8 @@"joinsProject": "Присоединится к команде и к {project}","copyLink": "Скопировать ссылку","copied": "Скопировано",+ "resendEmail": "Отправить письмо",+ "resendingEmail": "Отправка…","revokeAction": "Отозвать приглашение","revokeTitle": "Отозвать приглашение для {email}?","revokeConfirm": "Отозвать приглашение",diff --git a/apps/web/messages/uk/members.json b/apps/web/messages/uk/members.jsonindex 1a95b5c1..6a616c5a 100644--- a/apps/web/messages/uk/members.json+++ b/apps/web/messages/uk/members.json@@ -58,6 +58,7 @@"copied": "Скопійовано","emailQueued": "Лист із запрошенням поставлено в чергу","emailUnavailable": "Запрошення створено, але лист не поставлено в чергу. Скопіюйте посилання.",+ "emailFailed": "Запрошення створено, але лист не вдалося надіслати. Скопіюйте посилання, щоб поділитися ним.","resendUnavailable": "Пошту не налаштовано. Скопіюйте посилання на запрошення.","resendEmail": "Надіслати лист","resendingEmail": "У чергу…",@@ -65,7 +66,7 @@"renewing": "Оновлення…","renewed": "Запрошення оновлено: нове посилання надіслано поштою","renewedNoEmail": "Запрошення оновлено. Пошту не налаштовано: скопіюйте нове посилання, щоб поділитися ним.",- "renewedCopyLink": "Запрошення оновлено. Скопіюйте нове посилання, щоб поділитися ним.",+ "renewedEmailFailed": "Запрошення оновлено, але лист не вдалося надіслати. Скопіюйте нове посилання, щоб поділитися ним.","revokeAction": "Відкликати запрошення","removeAction": "Прибрати запрошення","invitedBy": "Запросив {name} · ",diff --git a/apps/web/messages/uk/teams.json b/apps/web/messages/uk/teams.jsonindex 9c1a73dd..2510620d 100644--- a/apps/web/messages/uk/teams.json+++ b/apps/web/messages/uk/teams.json@@ -108,6 +108,8 @@"joinsProject": "Приєднається до команди і до {project}","copyLink": "Скопіювати посилання","copied": "Скопійовано",+ "resendEmail": "Надіслати лист",+ "resendingEmail": "Надсилання…","revokeAction": "Відкликати запрошення","revokeTitle": "Відкликати запрошення для {email}?","revokeConfirm": "Відкликати запрошення",diff --git a/apps/web/messages/zh-CN/members.json b/apps/web/messages/zh-CN/members.jsonindex b8070a73..d26d1bb5 100644--- a/apps/web/messages/zh-CN/members.json+++ b/apps/web/messages/zh-CN/members.json@@ -58,6 +58,7 @@"copied": "已复制","emailQueued": "邀请邮件已加入发送队列","emailUnavailable": "邀请已创建,但邮件未加入发送队列。请复制链接进行分享。",+ "emailFailed": "邀请已创建,但邮件发送失败。请复制链接进行分享。","resendUnavailable": "邮件尚未配置。请复制邀请链接进行分享。","resendEmail": "发送邮件","resendingEmail": "正在加入队列…",@@ -65,7 +66,7 @@"renewing": "正在续期…","renewed": "邀请已续期:新链接已通过邮件发送","renewedNoEmail": "邀请已续期。尚未配置邮件:请复制新链接进行分享。",- "renewedCopyLink": "邀请已续期。请复制新链接进行分享。",+ "renewedEmailFailed": "邀请已续期,但邮件发送失败。请复制新链接进行分享。","revokeAction": "撤销邀请","removeAction": "移除邀请","invitedBy": "由 {name} 邀请 · ",diff --git a/apps/web/messages/zh-CN/teams.json b/apps/web/messages/zh-CN/teams.jsonindex fee91b88..d4a22519 100644--- a/apps/web/messages/zh-CN/teams.json+++ b/apps/web/messages/zh-CN/teams.json@@ -108,6 +108,8 @@"joinsProject": "加入团队和 {project}","copyLink": "复制链接","copied": "已复制",+ "resendEmail": "发送邮件",+ "resendingEmail": "正在发送…","revokeAction": "撤销邀请","revokeTitle": "撤销 {email} 的邀请?","revokeConfirm": "撤销邀请",diff --git a/apps/web/src/features/teams/components/members/TeamInviteRow.test.tsx b/apps/web/src/features/teams/components/members/TeamInviteRow.test.tsxindex c56c895e..77bd5635 100644--- a/apps/web/src/features/teams/components/members/TeamInviteRow.test.tsx+++ b/apps/web/src/features/teams/components/members/TeamInviteRow.test.tsx@@ -27,6 +27,7 @@ let dom: JSDOM;let root: Root;let originals: Map<string, PropertyDescriptor | undefined>;let renewed: number[] = [];+let resent: number[] = [];const DAY = 24 * 60 * 60 * 1000;const invite = (expiresInDays: number): InviteRow => ({@@ -57,6 +58,8 @@ async function render(row: InviteRow, { mayRenew = true } = {}) {onRevoke={() => {}}onRenew={mayRenew ? (i) => renewed.push(i.id) : undefined}renewing={false}+ onResend={(i) => resent.push(i.id)}+ resending={false}/></NextIntlClientProvider>,),@@ -84,6 +87,7 @@ beforeEach(async () => {value: true,});renewed = [];+ resent = [];const { createRoot } = await import('react-dom/client');root = createRoot(document.querySelector('#root')!);});@@ -103,6 +107,7 @@ describe('TeamInviteRow', () => {assert.ok(document.body.textContent?.includes(teams.invite.expiredAt.split(' ')[0]));assert.equal(button(teams.invite.copyLink), undefined);+ assert.equal(button(teams.invite.resendEmail), undefined);await act(async () => button(teams.invite.renew)!.click());assert.deepEqual(renewed, [9]);});@@ -120,5 +125,7 @@ describe('TeamInviteRow', () => {assert.ok(document.body.textContent?.includes(teams.invite.pending));assert.ok(button(teams.invite.copyLink));assert.equal(button(teams.invite.renew), undefined);+ await act(async () => button(teams.invite.resendEmail)!.click());+ assert.deepEqual(resent, [9]);});});diff --git a/apps/web/src/features/teams/components/members/TeamInviteRow.tsx b/apps/web/src/features/teams/components/members/TeamInviteRow.tsxindex 21a8af5d..6b91a248 100644--- a/apps/web/src/features/teams/components/members/TeamInviteRow.tsx+++ b/apps/web/src/features/teams/components/members/TeamInviteRow.tsx@@ -1,7 +1,7 @@'use client';import { useState } from 'react';-import { Check, Copy, RefreshCw, X } from 'lucide-react';+import { Check, Copy, Mail, RefreshCw, X } from 'lucide-react';import { useTranslations } from 'next-intl';import type { InviteRow } from '@/lib/api/endpoints/invites';import { isInviteExpired } from '@/utils/invites';@@ -12,18 +12,22 @@ import { Button } from '@/components/ui/button';import { formatShortDate } from '@/utils/dates';// An expired invite's link no longer works, so it offers a renewal in place of copying-// that link.+// or mailing that link.export default function TeamInviteRow({invite,onRevoke,onRenew,renewing,+ onResend,+ resending,}: {invite: InviteRow;onRevoke: (invite: InviteRow) => void;// Left out when the viewer may not renew this invite: the API would refuse it.onRenew?: (invite: InviteRow) => void;renewing: boolean;+ onResend: (invite: InviteRow) => void;+ resending: boolean;}) {const t = useTranslations('teams.invite');const tManage = useTranslations('teams.manage');@@ -71,15 +75,27 @@ export default function TeamInviteRow({</Button>)) : (- <Button- variant="ghost"- size="sm"- className="h-7 gap-1.5 text-xs text-muted-foreground hover:text-foreground"- onClick={copy}- >- {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}- {copied ? t('copied') : t('copyLink')}- </Button>+ <>+ <Button+ variant="ghost"+ size="sm"+ className="h-7 gap-1.5 text-xs text-muted-foreground hover:text-foreground"+ disabled={resending}+ onClick={() => onResend(invite)}+ >+ <Mail className="size-3.5" />+ {resending ? t('resendingEmail') : t('resendEmail')}+ </Button>+ <Button+ variant="ghost"+ size="sm"+ className="h-7 gap-1.5 text-xs text-muted-foreground hover:text-foreground"+ onClick={copy}+ >+ {copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}+ {copied ? t('copied') : t('copyLink')}+ </Button>+ </>)}<Buttonvariant="ghost"diff --git a/apps/web/src/features/teams/components/members/TeamInvitesList.test.tsx b/apps/web/src/features/teams/components/members/TeamInvitesList.test.tsxindex a4f919d9..e4574c41 100644--- a/apps/web/src/features/teams/components/members/TeamInvitesList.test.tsx+++ b/apps/web/src/features/teams/components/members/TeamInvitesList.test.tsx@@ -62,6 +62,8 @@ async function render(rows: InviteRow[]) {onRenew={() => {}}canRenew={() => true}renewingId={null}+ onResend={() => {}}+ resendingId={null}/></NextIntlClientProvider>,),diff --git a/apps/web/src/features/teams/components/members/TeamInvitesList.tsx b/apps/web/src/features/teams/components/members/TeamInvitesList.tsxindex a0e35aa9..4cd9bee3 100644--- a/apps/web/src/features/teams/components/members/TeamInvitesList.tsx+++ b/apps/web/src/features/teams/components/members/TeamInvitesList.tsx@@ -14,12 +14,16 @@ export default function TeamInvitesList({onRenew,canRenew,renewingId,+ onResend,+ resendingId,}: {invites: InviteRow[];onRevoke: (invite: InviteRow) => void;onRenew: (invite: InviteRow) => void;canRenew: (invite: InviteRow) => boolean;renewingId: number | null;+ onResend: (invite: InviteRow) => void;+ resendingId: number | null;}) {const tMembers = useTranslations('members.invites');const byEmail = new Map<string, InviteRow[]>();@@ -49,6 +53,8 @@ export default function TeamInvitesList({onRevoke={onRevoke}onRenew={canRenew(invite) ? onRenew : undefined}renewing={renewingId === invite.id}+ onResend={onResend}+ resending={resendingId === invite.id}/>))}</div>diff --git a/apps/web/src/features/teams/components/members/TeamMembersSection.tsx b/apps/web/src/features/teams/components/members/TeamMembersSection.tsxindex 975b1e43..c5d88403 100644--- a/apps/web/src/features/teams/components/members/TeamMembersSection.tsx+++ b/apps/web/src/features/teams/components/members/TeamMembersSection.tsx@@ -10,6 +10,7 @@ import type { TeamMember } from '@/lib/api/endpoints/teams';import {useDeleteTeamInvite,useRenewTeamInvite,+ useSendTeamInviteEmail,useRemoveTeamMember,useTeam,useTeamInvitesQuery,@@ -53,6 +54,7 @@ export default function TeamMembersSection({ teamId }: { teamId: number }) {const invitesQuery = useTeamInvitesQuery(teamId, canInvite);const deleteInvite = useDeleteTeamInvite(teamId);const renewInvite = useRenewTeamInvite(teamId);+ const sendInviteEmail = useSendTeamInviteEmail(teamId);const removeMember = useRemoveTeamMember(teamId);const [inviting, setInviting] = useState(false);const [target, setTarget] = useState<InviteRow | null>(null);@@ -110,6 +112,8 @@ export default function TeamMembersSection({ teamId }: { teamId: number }) {mayRenewInvite(invite, { teamRole: team?.role ?? null, ownsProject: false })}renewingId={renewInvite.isPending ? (renewInvite.variables ?? null) : null}+ onResend={(valid) => sendInviteEmail.mutate(valid.id)}+ resendingId={sendInviteEmail.isPending ? (sendInviteEmail.variables ?? null) : null}/>)}diff --git a/apps/web/src/lib/api/endpoints/invites.ts b/apps/web/src/lib/api/endpoints/invites.tsindex eedf0531..537a03e4 100644--- a/apps/web/src/lib/api/endpoints/invites.ts+++ b/apps/web/src/lib/api/endpoints/invites.ts@@ -36,6 +36,8 @@ export interface InviteRow {export interface InviteCreateResult extends InviteRow {emailQueued: boolean;+ // A mail provider is set but the email could not go out; the link still works.+ emailFailed: boolean;}export interface InviteEmailResult {@@ -104,11 +106,14 @@ export const deleteInvite = (projectKey: string, inviteId: number) =>export const listTeamInvites = (teamId: number) => request<InviteRow[]>(`/teams/${teamId}/invites`);export const createTeamInvite = (teamId: number, input: { email: string; role: InviteTeamRole }) =>- request<InviteRow>(`/teams/${teamId}/invites`, {+ request<InviteCreateResult>(`/teams/${teamId}/invites`, {method: 'POST',body: JSON.stringify(input),});+export const sendTeamInviteEmail = (teamId: number, inviteId: number) =>+ request<InviteEmailResult>(`/teams/${teamId}/invites/${inviteId}/email`, { method: 'POST' });+export const renewTeamInvite = (teamId: number, inviteId: number) =>request<InviteCreateResult>(`/teams/${teamId}/invites/${inviteId}/renew`, { method: 'POST' });diff --git a/apps/web/src/services/members.service.ts b/apps/web/src/services/members.service.tsindex 038ce4cd..c07b0b91 100644--- a/apps/web/src/services/members.service.ts+++ b/apps/web/src/services/members.service.ts@@ -129,6 +129,7 @@ export function useCreateInvite(projectKey: string) {onSuccess: (result) => {qc.invalidateQueries({ queryKey: qk.invites(projectKey) });if (result.emailQueued) toast.success(t('emailQueued'));+ else if (result.emailFailed) toast.error(t('emailFailed'));else toast.info(t('emailUnavailable'));},// As with useAddMember: the add dialog owns the error UI.@@ -155,6 +156,7 @@ export function useRenewInvite(projectKey: string) {onSuccess: (result) => {qc.invalidateQueries({ queryKey: qk.invites(projectKey) });if (result.emailQueued) toast.success(t('renewed'));+ else if (result.emailFailed) toast.error(t('renewedEmailFailed'));else toast.info(t('renewedNoEmail'));},});diff --git a/apps/web/src/services/teams.service.ts b/apps/web/src/services/teams.service.tsindex 79475321..c207104b 100644--- a/apps/web/src/services/teams.service.ts+++ b/apps/web/src/services/teams.service.ts@@ -12,6 +12,7 @@ import {listTeamInvites,createTeamInvite,renewTeamInvite,+ sendTeamInviteEmail,deleteTeamInvite,} from '@/lib/api/endpoints/invites';import type { MemberKind, MemberListParams } from '@/lib/api/endpoints/members';@@ -259,14 +260,31 @@ export function useTeamInvitesQuery(teamId: number, enabled = true) {// The invite dialog shows the reason under its address field, so this mutation opts// out of the global error toast.export function useCreateTeamInvite(teamId: number) {+ const t = useTranslations('members.invites');const qc = useQueryClient();return useMutation({mutationFn: (input: { email: string; role: InviteTeamRole }) => createTeamInvite(teamId, input),- onSuccess: () => qc.invalidateQueries({ queryKey: qk.teamInvites(teamId) }),+ onSuccess: (result) => {+ qc.invalidateQueries({ queryKey: qk.teamInvites(teamId) });+ if (result.emailQueued) toast.success(t('emailQueued'));+ else if (result.emailFailed) toast.error(t('emailFailed'));+ else toast.info(t('emailUnavailable'));+ },meta: { suppressErrorToast: true },});}+export function useSendTeamInviteEmail(teamId: number) {+ const t = useTranslations('members.invites');+ return useMutation({+ mutationFn: (inviteId: number) => sendTeamInviteEmail(teamId, inviteId),+ onSuccess: (result) => {+ if (result.emailQueued) toast.success(t('emailQueued'));+ else toast.info(t('resendUnavailable'));+ },+ });+}+export function useRenewTeamInvite(teamId: number) {const t = useTranslations('members.invites');const qc = useQueryClient();@@ -275,8 +293,7 @@ export function useRenewTeamInvite(teamId: number) {onSuccess: (result) => {qc.invalidateQueries({ queryKey: qk.teamInvites(teamId) });if (result.emailQueued) toast.success(t('renewed'));- // A team invite has no email of its own; only a project one is mailed.- else if (result.projectName == null) toast.info(t('renewedCopyLink'));+ else if (result.emailFailed) toast.error(t('renewedEmailFailed'));else toast.info(t('renewedNoEmail'));},});