Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🔥 Remove legacy /p/ and /admin/ poll link redirects (#2781)
Luke Velladf42459d0d35
diff --git a/apps/web/next.config.ts b/apps/web/next.config.tsindex 38b8a2854..088d2c314 100644--- a/apps/web/next.config.ts+++ b/apps/web/next.config.ts@@ -107,16 +107,6 @@ const nextConfig: NextConfig = {destination: "/api/better-auth/callback/microsoft",permanent: false,},- {- source: "/p/:participantUrlId",- destination: "/api/legacy/p/:participantUrlId",- permanent: true,- },- {- source: "/admin/:adminUrlId",- destination: "/api/legacy/admin/:adminUrlId",- permanent: true,- },];},async headers() {diff --git a/apps/web/src/app/api/legacy/[...route]/route.ts b/apps/web/src/app/api/legacy/[...route]/route.tsdeleted file mode 100644index 73a0111fe..000000000--- a/apps/web/src/app/api/legacy/[...route]/route.ts+++ /dev/null@@ -1,35 +0,0 @@-import { prisma } from "@rallly/database";-import { Hono } from "hono";-import { handle } from "hono/vercel";--const app = new Hono().basePath("/api/legacy");--app.get("/p/:participantUrlId", async (c) => {- const poll = await prisma.poll.findUnique({- where: { participantUrlId: c.req.param("participantUrlId") },- select: { id: true },- });-- if (!poll) {- return c.notFound();- }-- c.header("Cache-Control", "public, max-age=31536000, immutable");- return c.redirect(`/invite/${poll.id}`, 301);-});--app.get("/admin/:adminUrlId", async (c) => {- const poll = await prisma.poll.findUnique({- where: { adminUrlId: c.req.param("adminUrlId") },- select: { id: true },- });-- if (!poll) {- return c.notFound();- }-- c.header("Cache-Control", "public, max-age=31536000, immutable");- return c.redirect(`/poll/${poll.id}`, 301);-});--export const GET = handle(app);diff --git a/apps/web/src/features/poll/mutations.ts b/apps/web/src/features/poll/mutations.tsindex ca66b4564..96ab3e96a 100644--- a/apps/web/src/features/poll/mutations.ts+++ b/apps/web/src/features/poll/mutations.ts@@ -50,8 +50,6 @@ export const createPoll = async ({hideParticipants,hideScores,disableComments,- adminUrlId: nanoid(),- participantUrlId: nanoid(),userId,spaceId,kind,diff --git a/apps/web/src/trpc/client/types.ts b/apps/web/src/trpc/client/types.tsindex d57ff018b..d87b9339e 100644--- a/apps/web/src/trpc/client/types.ts+++ b/apps/web/src/trpc/client/types.ts@@ -15,7 +15,6 @@ export type GetPollApiResponse = {timeZone: string | null;canManage: boolean;status: PollStatus;- participantUrlId: string;createdAt: Date;deleted: boolean;event: {diff --git a/apps/web/src/trpc/routers/polls.ts b/apps/web/src/trpc/routers/polls.tsindex 972fd4b1b..9ce40214e 100644--- a/apps/web/src/trpc/routers/polls.ts+++ b/apps/web/src/trpc/routers/polls.ts@@ -159,8 +159,6 @@ export const polls = router({const title = input.title;const location = input.location || undefined;const description = input.description || undefined;- const adminToken = nanoid();- const participantUrlId = nanoid();const pollId = nanoid();const spaceId = activeSpace?.id;@@ -198,8 +196,6 @@ export const polls = router({timeZone,location,description,- adminUrlId: adminToken,- participantUrlId,userId: ctx.user.id,kind,options: {@@ -638,7 +634,6 @@ export const polls = router({location: true,description: true,createdAt: true,- participantUrlId: true,status: true,closedReason: true,hideParticipants: true,@@ -1254,8 +1249,6 @@ export const polls = router({hideParticipants: poll.hideParticipants,hideScores: poll.hideScores,disableComments: poll.disableComments,- adminUrlId: nanoid(),- participantUrlId: nanoid(),kind: poll.kind,options: {create: poll.options,diff --git a/apps/web/tests/cross-timezone.spec.ts b/apps/web/tests/cross-timezone.spec.tsindex a041ad360..ce102de12 100644--- a/apps/web/tests/cross-timezone.spec.ts+++ b/apps/web/tests/cross-timezone.spec.ts@@ -113,8 +113,6 @@ async function seed() {data: {id: ZONED_POLL_ID,title: "Cross TZ Zoned Poll",- participantUrlId: `${ZONED_POLL_ID}-participant`,- adminUrlId: `${ZONED_POLL_ID}-admin`,kind: "time",timeZone: "Europe/London",options: {@@ -127,8 +125,6 @@ async function seed() {data: {id: FLOATING_POLL_ID,title: "Cross TZ Floating Poll",- participantUrlId: `${FLOATING_POLL_ID}-participant`,- adminUrlId: `${FLOATING_POLL_ID}-admin`,kind: "time",timeZone: null,options: {@@ -141,8 +137,6 @@ async function seed() {data: {id: DATE_POLL_ID,title: "Cross TZ Date Poll",- participantUrlId: `${DATE_POLL_ID}-participant`,- adminUrlId: `${DATE_POLL_ID}-admin`,kind: "date",timeZone: null,options: {diff --git a/apps/web/tests/house-keeping.spec.ts b/apps/web/tests/house-keeping.spec.tsindex 2d900f80b..d20b68822 100644--- a/apps/web/tests/house-keeping.spec.ts+++ b/apps/web/tests/house-keeping.spec.ts@@ -241,8 +241,6 @@ test.describe("House-keeping API", () => {data: {id: "old-deleted-poll",title: "Old Deleted Poll",- participantUrlId: "old-deleted-poll-participant",- adminUrlId: "old-deleted-poll-admin",deleted: true,deletedAt: dayjs().subtract(8, "day").toDate(), // Deleted 8 days ago},@@ -254,8 +252,6 @@ test.describe("House-keeping API", () => {data: {id: "recent-deleted-poll",title: "Recent Deleted Poll",- participantUrlId: "recent-deleted-poll-participant",- adminUrlId: "recent-deleted-poll-admin",deleted: true,deletedAt: dayjs().subtract(3, "day").toDate(), // Deleted 3 days ago},@@ -302,8 +298,6 @@ test.describe("House-keeping API", () => {data: {id: "ac-all-past",title: "Auto-close: all options in the past",- participantUrlId: "ac-all-past-participant",- adminUrlId: "ac-all-past-admin",options: {create: {startTime: dayjs().subtract(10, "day").toDate(),@@ -320,8 +314,6 @@ test.describe("House-keeping API", () => {data: {id: "ac-allday-past",title: "Auto-close: past all-day option",- participantUrlId: "ac-allday-past-participant",- adminUrlId: "ac-allday-past-admin",options: {create: {startTime: dayjs().subtract(5, "day").toDate(),@@ -337,8 +329,6 @@ test.describe("House-keeping API", () => {data: {id: "ac-future",title: "Auto-close: has a future option",- participantUrlId: "ac-future-participant",- adminUrlId: "ac-future-admin",options: {create: {startTime: dayjs().add(10, "day").toDate(),@@ -354,8 +344,6 @@ test.describe("House-keeping API", () => {data: {id: "ac-mixed",title: "Auto-close: past and future options",- participantUrlId: "ac-mixed-participant",- adminUrlId: "ac-mixed-admin",options: {create: [{ startTime: dayjs().subtract(10, "day").toDate(), duration: 60 },@@ -372,8 +360,6 @@ test.describe("House-keeping API", () => {data: {id: "ac-running",title: "Auto-close: option still running",- participantUrlId: "ac-running-participant",- adminUrlId: "ac-running-admin",options: {create: {startTime: dayjs().subtract(30, "minute").toDate(),@@ -390,8 +376,6 @@ test.describe("House-keeping API", () => {data: {id: "ac-no-options",title: "Auto-close: no options",- participantUrlId: "ac-no-options-participant",- adminUrlId: "ac-no-options-admin",},});createdPollIds.push(noOptions.id);@@ -401,8 +385,6 @@ test.describe("House-keeping API", () => {data: {id: "ac-scheduled",title: "Auto-close: already scheduled",- participantUrlId: "ac-scheduled-participant",- adminUrlId: "ac-scheduled-admin",status: "scheduled",options: {create: {diff --git a/apps/web/tests/test-utils.ts b/apps/web/tests/test-utils.tsindex 0d9bc4610..6f0cf6a3f 100644--- a/apps/web/tests/test-utils.ts+++ b/apps/web/tests/test-utils.ts@@ -134,8 +134,6 @@ export async function createTestPoll({const pollData = {id,title,- participantUrlId: `${id}-participant`,- adminUrlId: `${id}-admin`,userId,spaceId,updatedAt,diff --git a/packages/database/prisma/migrations/20260729000000_drop_legacy_url_id_columns/migration.sql b/packages/database/prisma/migrations/20260729000000_drop_legacy_url_id_columns/migration.sqlnew file mode 100644index 000000000..cc44f5093--- /dev/null+++ b/packages/database/prisma/migrations/20260729000000_drop_legacy_url_id_columns/migration.sql@@ -0,0 +1,9 @@+-- DropIndex+DROP INDEX "polls_admin_url_id_key";++-- DropIndex+DROP INDEX "polls_participant_url_id_key";++-- AlterTable+ALTER TABLE "polls" DROP COLUMN "admin_url_id",+DROP COLUMN "participant_url_id";diff --git a/packages/database/prisma/models/poll.prisma b/packages/database/prisma/models/poll.prismaindex 33f4d50ce..f1838981f 100644--- a/packages/database/prisma/models/poll.prisma+++ b/packages/database/prisma/models/poll.prisma@@ -44,8 +44,6 @@ model Poll {kind PollKind @default(date)deleted Boolean @default(false)deletedAt DateTime? @map("deleted_at")- participantUrlId String @unique @map("participant_url_id")- adminUrlId String @unique @map("admin_url_id")eventId String? @unique @map("event_id")scheduledEventId String? @map("scheduled_event_id")hideParticipants Boolean @default(false) @map("hide_participants")diff --git a/packages/database/prisma/seed.ts b/packages/database/prisma/seed.tsindex d5785d602..448afee3c 100644--- a/packages/database/prisma/seed.ts+++ b/packages/database/prisma/seed.ts@@ -97,8 +97,6 @@ async function main() {for (const poll of polls) {const pollId = nextId();- const adminUrlId = nextId();- const participantUrlId = nextId();const kind = poll.options.some((opt) => opt.duration > 0) ? "time" : "date";@@ -114,8 +112,6 @@ async function main() {deadline: poll.deadline ? new Date(poll.deadline) : undefined,userId: poll.userId,spaceId: poll.spaceId,- adminUrlId,- participantUrlId,scheduledEventId: poll.scheduledEventId,hideParticipants: poll.hideParticipants,hideScores: poll.hideScores,diff --git a/packages/screenshots/capture/poll-admin.spec.ts b/packages/screenshots/capture/poll-admin.spec.tsindex d9d81c38f..0e98dfc89 100644--- a/packages/screenshots/capture/poll-admin.spec.ts+++ b/packages/screenshots/capture/poll-admin.spec.ts@@ -28,8 +28,6 @@ test.beforeAll(async () => {spaceId: "space-2",status: "open",timeZone: "America/New_York",- adminUrlId: "screenshot-admin",- participantUrlId: "screenshot-participant",options: {create: [{