From 0e168924555cae4e1d212152b575a579eb320b85 Mon Sep 17 00:00:00 2001 From: Tommaso Morganti Date: Sat, 31 Oct 2026 02:13:29 +0100 Subject: [PATCH] fix(people): send invites to the dashboard's ungated landing page, and rename Design to Design & Marketing The invite link pointed at /dashboard/account/me, behind the dashboard gate, which needs admin:access or people:self: someone whose roles haven't been applied yet couldn't open it. It now points at /people/invite, which any signed-in account can open (PoliNetworkOrg/admin#140). The Design team is called Design & Marketing, as in the dashboard (PoliNetworkOrg/admin#139). --- src/people/contract.ts | 2 +- src/people/service.ts | 2 +- tests/people-router.test.ts | 2 +- tests/people.test.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/people/contract.ts b/src/people/contract.ts index 7d11792..7bcf5aa 100644 --- a/src/people/contract.ts +++ b/src/people/contract.ts @@ -240,7 +240,7 @@ export const TEAMS = { ], }, design: { - name: "Design & Social", + name: "Design & Marketing", fields: [ { key: "tools", diff --git a/src/people/service.ts b/src/people/service.ts index 66f391b..ae6a2d9 100644 --- a/src/people/service.ts +++ b/src/people/service.ts @@ -761,7 +761,7 @@ export function createPeopleService(options: PeopleOptions) { `invite:${invite.id}`, p.contactEmail, "PoliNetwork ยท collega il tuo account", - inviteText(p, `${dashboardUrl}/dashboard/account/me?peopleInvite=${token}`, invite.expiresAt) + inviteText(p, `${dashboardUrl}/people/invite?token=${token}`, invite.expiresAt) ) log(u, p.id, v.sub, "Queued an account invite", now()) }) diff --git a/tests/people-router.test.ts b/tests/people-router.test.ts index bc8cd4d..7439a9c 100644 --- a/tests/people-router.test.ts +++ b/tests/people-router.test.ts @@ -62,7 +62,7 @@ describe("People tRPC contract", () => { const h = harness() await h.seed(false) await h.service.sendInvite(master, { personId: "P-0003" }) - const token = Object.values(h.state().mail)[0].text.match(/peopleInvite=([A-Za-z0-9_-]{43})/)?.[1] ?? "" + const token = Object.values(h.state().mail)[0].text.match(/invite\?token=([A-Za-z0-9_-]{43})/)?.[1] ?? "" const actor: Actor = { kind: "user", sub: "newcomer", client: "admin-dashboard", telegramId: null } const caller = makeRouter(h.service).createCaller(context([], actor)) await expect(caller.me.get()).rejects.toMatchObject({ code: "FORBIDDEN" }) diff --git a/tests/people.test.ts b/tests/people.test.ts index 7e5ac73..59ef7a3 100644 --- a/tests/people.test.ts +++ b/tests/people.test.ts @@ -401,7 +401,7 @@ describe("Pending assignments follow Auth's rules", () => { const tokenOf = (h: ReturnType) => Object.values(h.state().mail) .at(-1) - ?.text.match(/peopleInvite=([A-Za-z0-9_-]{43})/)?.[1] ?? "" + ?.text.match(/invite\?token=([A-Za-z0-9_-]{43})/)?.[1] ?? "" describe("Linking by invite", () => { it("links whichever account accepts, acting as each assigner, without People permissions or a matching email", async () => { @@ -787,7 +787,7 @@ describe("People mail outbox", () => { id: mail.id, to: "luca@example.org", subject: mail.subject, - text: expect.stringContaining("https://admin.example.org/dashboard/account/me?peopleInvite="), + text: expect.stringContaining("https://admin.example.org/people/invite?token="), }) expect(h.state().mail[mail.id]).toMatchObject({ status: "sent", error: null }) await h.service.deliverPending()