Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🔒️ Ban repeat moderation offenders and close the Pro bypass (#3280)
Luke Vellaf3a541952c8c
diff --git a/apps/web/src/app/[locale]/control-panel/users/actions.ts b/apps/web/src/app/[locale]/control-panel/users/actions.tsindex 4ab15d1d1..255169e26 100644--- a/apps/web/src/app/[locale]/control-panel/users/actions.ts+++ b/apps/web/src/app/[locale]/control-panel/users/actions.ts@@ -1,10 +1,12 @@"use server";+import { subject } from "@casl/ability";import * as z from "zod";import {cancelUserSubscriptions,deleteStripeCustomer,} from "@/features/billing/mutations";-import { getUserDeletionDetails } from "@/features/user/data";+import { banUserForAbuse } from "@/features/moderation/mutations";+import { getUser, getUserDeletionDetails } from "@/features/user/data";import { hardDeleteUser } from "@/features/user/mutations";import { AppError } from "@/lib/errors/app-error";import { deletePostHogPerson } from "@/lib/posthog";@@ -54,3 +56,45 @@ export const deleteUserAction = adminActionClientsuccess: true,};});++// Route-private for the same reason: a ban cancels the user's subscriptions,+// through the moderation feature's ban step.+export const banUserAction = adminActionClient+ .metadata({ actionName: "ban_user" })+ .inputSchema(+ z.object({+ userId: z.string(),+ reason: z.string().trim().max(500).optional(),+ }),+ )+ .action(async ({ ctx, parsedInput }) => {+ const { userId, reason } = parsedInput;++ const targetUser = await getUser(userId);++ if (!targetUser) {+ throw new AppError({+ code: "NOT_FOUND",+ message: `User ${userId} not found`,+ });+ }++ if (targetUser.banned) {+ throw new AppError({+ code: "FORBIDDEN",+ message: "User is already banned",+ });+ }++ if (ctx.ability.cannot("update", subject("User", targetUser), "banned")) {+ throw new AppError({+ code: "UNAUTHORIZED",+ message: "Current user is not authorized to ban this user",+ });+ }++ await banUserForAbuse({+ userId,+ reason: reason || "Banned from the control panel",+ });+ });diff --git a/apps/web/src/app/[locale]/control-panel/users/dialogs/ban-user-dialog.tsx b/apps/web/src/app/[locale]/control-panel/users/dialogs/ban-user-dialog.tsxindex 5d2ffdf97..d1b7ebe6d 100644--- a/apps/web/src/app/[locale]/control-panel/users/dialogs/ban-user-dialog.tsx+++ b/apps/web/src/app/[locale]/control-panel/users/dialogs/ban-user-dialog.tsx@@ -21,9 +21,9 @@ import {import { Textarea } from "@rallly/ui/textarea";import { useForm } from "react-hook-form";import * as z from "zod";-import { banUserAction } from "@/features/user/actions";import { Trans, useTranslation } from "@/i18n/client";import { useSafeAction } from "@/lib/safe-action/client";+import { banUserAction } from "../actions";const useSchema = () => {const { t } = useTranslation();diff --git a/apps/web/src/app/[locale]/invite/[urlId]/page.tsx b/apps/web/src/app/[locale]/invite/[urlId]/page.tsxindex e081653e4..741c2fc8b 100644--- a/apps/web/src/app/[locale]/invite/[urlId]/page.tsx+++ b/apps/web/src/app/[locale]/invite/[urlId]/page.tsx@@ -33,6 +33,15 @@ const getPollMetadata = cache(async (urlId: string) => {banned: true,},},+ space: {+ select: {+ owner: {+ select: {+ banned: true,+ },+ },+ },+ },},});@@ -43,10 +52,12 @@ const getPollMetadata = cache(async (urlId: string) => {// A poll that exists but must not be served gets its own page instead of// a 404: the viewer of a banned creator's poll is usually a scam target// and needs to be told so, and a deleted poll's viewer deserves better- // than "page not found".+ // than "page not found". The space owner counts as a creator too: an API+ // key holder can organize polls under any member, and banning the payer+ // must take every link in the space down with it.const unavailable: PollUnavailableReason | null = poll.deleted? "deleted"- : poll.user?.banned+ : poll.user?.banned || poll.space?.owner.banned? "removed": null;diff --git a/apps/web/src/app/api/middleware/api-key.ts b/apps/web/src/app/api/middleware/api-key.tsindex 146b4e415..008d89e00 100644--- a/apps/web/src/app/api/middleware/api-key.ts+++ b/apps/web/src/app/api/middleware/api-key.ts@@ -56,6 +56,11 @@ const verifyKey = bearerAuth<ApiKeyAuthEnv>({select: {ownerId: true,tier: true,+ owner: {+ select: {+ banned: true,+ },+ },},},},@@ -76,7 +81,9 @@ const verifyKey = bearerAuth<ApiKeyAuthEnv>({) {// Verify the full key hashconst isValid = await verifyApiKey(rawKey, candidate.hashedKey);- if (isValid) {+ // A banned owner's keys stay in the table but must not authenticate:+ // the ban is the only thing standing between a scammer and the API.+ if (isValid && !candidate.space.owner.banned) {apiKeyId = candidate.id;spaceId = candidate.spaceId;spaceOwnerId = candidate.space.ownerId;diff --git a/apps/web/src/app/api/private/[...route]/route.test.ts b/apps/web/src/app/api/private/[...route]/route.test.tsindex edbe3d47d..b7fe458da 100644--- a/apps/web/src/app/api/private/[...route]/route.test.ts+++ b/apps/web/src/app/api/private/[...route]/route.test.ts@@ -12,6 +12,10 @@ const mockListPolls = vi.fn();const mockTrack = vi.fn();const mockIdentifyGroup = vi.fn();+vi.mock("@/features/moderation/mutations", () => ({+ moderateContent: vi.fn().mockResolvedValue({ verdict: "safe", reason: "" }),+}));+vi.mock("@/features/poll/mutations", () => ({deletePoll: (...args: unknown[]) => mockDeletePoll(...args),createPoll: (...args: unknown[]) => mockCreatePoll(...args),@@ -74,6 +78,7 @@ vi.mock("@/lib/posthog", () => ({import { prisma } from "@rallly/database";import { after } from "next/server";import { hashApiKey, verifyApiKey } from "@/features/api-keys/utils";+import { moderateContent } from "@/features/moderation/mutations";import { MAX_SLOT_GENERATION_DAYS } from "@/lib/datetime/slot-generator";import { redis } from "@/lib/kv";import type { FakeRedis } from "../../middleware/fake-redis";@@ -124,6 +129,7 @@ const mockApiKey = {space: {ownerId: "test-user-id",tier: "pro",+ owner: { banned: false },},};@@ -445,6 +451,30 @@ describe("Private API - /polls", () => {});describe("Create poll with dates", () => {+ it("rejects a flagged poll with INAPPROPRIATE_CONTENT", async () => {+ vi.mocked(moderateContent).mockResolvedValueOnce({+ verdict: "flagged",+ reason: "phishing",+ });++ const res = await app.request("/api/private/polls", {+ method: "POST",+ headers: {+ Authorization: `Bearer ${testApiKey}`,+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ title: "Verify your account",+ dates: ["2025-01-15"],+ }),+ });++ expect(res.status).toBe(400);+ const json = await res.json();+ expect(json.error.code).toBe("INAPPROPRIATE_CONTENT");+ expect(mockCreatePoll).not.toHaveBeenCalled();+ });+it("should create a poll with date options", async () => {const res = await app.request("/api/private/polls", {method: "POST",diff --git a/apps/web/src/app/api/private/[...route]/route.ts b/apps/web/src/app/api/private/[...route]/route.tsindex 7a8bf7346..292cf7c1e 100644--- a/apps/web/src/app/api/private/[...route]/route.ts+++ b/apps/web/src/app/api/private/[...route]/route.ts@@ -12,6 +12,7 @@ import {validator,} from "hono-openapi";import { after } from "next/server";+import { moderateContent } from "@/features/moderation/mutations";import { MAX_POLL_OPTIONS } from "@/features/poll/constants";import {getPollParticipants,@@ -300,6 +301,27 @@ app.post(organizerUserId = spaceMember.user.id;}+ // Same gate as the app. The strike goes to the key holder, who is the+ // paying account, whichever member the poll is organized by.+ const moderation = await moderateContent({+ userId: spaceOwnerId,+ content: {+ Title: input.title,+ Description: input.description ?? "",+ Location: input.location ?? "",+ },+ });++ if (moderation.verdict === "flagged") {+ return c.json(+ apiError(+ "INAPPROPRIATE_CONTENT",+ "This content was flagged by moderation and cannot be published.",+ ),+ 400,+ );+ }+const trackPollCreated = (poll: Awaited<ReturnType<typeof createPoll>>) => {const kind = poll.options.some((o) => o.duration > 0) ? "time" : "date";diff --git a/apps/web/src/app/api/v1/[...route]/route.test.ts b/apps/web/src/app/api/v1/[...route]/route.test.tsindex 588a25136..28ce69c70 100644--- a/apps/web/src/app/api/v1/[...route]/route.test.ts+++ b/apps/web/src/app/api/v1/[...route]/route.test.ts@@ -14,6 +14,10 @@ const mockGetSpaceMemberByEmail = vi.fn();const mockTrack = vi.fn();const mockIdentifyGroup = vi.fn();+vi.mock("@/features/moderation/mutations", () => ({+ moderateContent: vi.fn().mockResolvedValue({ verdict: "safe", reason: "" }),+}));+vi.mock("@/features/poll/mutations", () => ({deletePoll: (...args: unknown[]) => mockDeletePoll(...args),createPoll: (...args: unknown[]) => mockCreatePoll(...args),@@ -77,6 +81,7 @@ vi.mock("@/lib/posthog", () => ({import { logger } from "@rallly/logger";import { after } from "next/server";import { hashApiKey, verifyApiKey } from "@/features/api-keys/utils";+import { moderateContent } from "@/features/moderation/mutations";import { MAX_POLL_TITLE_LENGTH } from "@/features/poll/schema";import { MAX_SLOT_GENERATION_DAYS } from "@/lib/datetime/slot-generator";import { redis } from "@/lib/kv";@@ -143,6 +148,7 @@ const mockApiKey = {space: {ownerId: "test-user-id",tier: "pro",+ owner: { banned: false },},};@@ -331,6 +337,55 @@ describe("API v1 - /polls", () => {});});+ describe("content moderation", () => {+ it("rejects a flagged poll with INAPPROPRIATE_CONTENT", async () => {+ vi.mocked(moderateContent).mockResolvedValueOnce({+ verdict: "flagged",+ reason: "phishing",+ });++ const res = await app.request("/v1/polls", {+ method: "POST",+ headers: {+ Authorization: `Bearer ${testApiKey}`,+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ title: "Verify your account",+ options: { kind: "date", dates: ["2025-01-15"] },+ }),+ });++ await expectErrorEnvelope(res, {+ status: 400,+ code: "INAPPROPRIATE_CONTENT",+ });+ expect(mockCreatePoll).not.toHaveBeenCalled();+ });+ });++ describe("banned owner", () => {+ it("rejects a valid key when the space owner is banned", async () => {+ vi.mocked(prisma.spaceApiKey.findMany).mockResolvedValue([+ {+ ...mockApiKey,+ hashedKey: hashApiKey(testApiKey),+ space: { ...mockApiKey.space, owner: { banned: true } },+ },+ ]);++ const res = await app.request("/v1/polls/test-poll-id", {+ method: "GET",+ headers: {+ Authorization: `Bearer ${testApiKey}`,+ },+ });++ await expectErrorEnvelope(res, { status: 401, code: "UNAUTHORIZED" });+ expect(after).not.toHaveBeenCalled();+ });+ });+describe("lastUsedAt throttling", () => {it("should not schedule a write when lastUsedAt is recent", async () => {vi.mocked(prisma.spaceApiKey.findMany).mockResolvedValue([diff --git a/apps/web/src/app/api/v1/[...route]/route.ts b/apps/web/src/app/api/v1/[...route]/route.tsindex 444291194..0d1d2dea0 100644--- a/apps/web/src/app/api/v1/[...route]/route.ts+++ b/apps/web/src/app/api/v1/[...route]/route.ts@@ -9,6 +9,7 @@ import {validator,} from "hono-openapi";import { after } from "next/server";+import { moderateContent } from "@/features/moderation/mutations";import { MAX_POLL_OPTIONS } from "@/features/poll/constants";import {getPollParticipants,@@ -207,7 +208,7 @@ app.onError((error, c) => {const unauthorizedResponse = {description:- "The API key is missing, invalid, expired or revoked. Includes a `WWW-Authenticate` header.",+ "The API key is missing, invalid, expired or revoked, or its owner is banned. Includes a `WWW-Authenticate` header.",headers: {"WWW-Authenticate": {description: "The bearer challenge, per RFC 6750.",@@ -305,9 +306,10 @@ async function buildOpenApiSpec() {"| 400 | `INVALID_AUTHORIZATION_HEADER` | The `Authorization` header is not `Bearer <key>` |","| 400 | `ORGANIZER_NOT_MEMBER` | The organizer email is not a member of the space |","| 400 | `TOO_MANY_OPTIONS` | More than the maximum number of poll options |",+ "| 400 | `INAPPROPRIATE_CONTENT` | The title, description or location was flagged by content moderation |","| 400 | `DUPLICATE_DATES` | `options.dates` contains the same date more than once |","| 400 | `NO_OPTIONS_GENERATED` | No slot generator produced a valid time slot |",- "| 401 | `UNAUTHORIZED` | The API key is missing, invalid, expired or revoked |",+ "| 401 | `UNAUTHORIZED` | The API key is missing, invalid, expired or revoked, or its owner is banned |","| 403 | `SPACE_NOT_PRO` | The space behind the key has no Pro subscription |","| 404 | `NOT_FOUND` | No route matches the method and path |","| 404 | `POLL_NOT_FOUND` | The poll does not exist or belongs to another space |",@@ -494,6 +496,27 @@ app.post(organizerUserId = spaceMember.userId;}+ // Same gate as the app. The strike goes to the key holder, who is the+ // paying account, whichever member the poll is organized by.+ const moderation = await moderateContent({+ userId: spaceOwnerId,+ content: {+ Title: input.title,+ Description: input.description ?? "",+ Location: input.location ?? "",+ },+ });++ if (moderation.verdict === "flagged") {+ return c.json(+ apiError(+ "INAPPROPRIATE_CONTENT",+ "This content was flagged by moderation and cannot be published.",+ ),+ 400,+ );+ }+const trackPollCreated = (poll: Awaited<ReturnType<typeof createPoll>>) => {const kind = poll.options.some((o) => o.duration > 0) ? "time" : "date";diff --git a/apps/web/src/features/moderation/constants.ts b/apps/web/src/features/moderation/constants.tsnew file mode 100644index 000000000..69d254009--- /dev/null+++ b/apps/web/src/features/moderation/constants.ts@@ -0,0 +1,11 @@+// Flagged verdicts a user may collect in one window before the account is+// banned. Flags are rare and every one in the last 90 days was phishing, so+// a repeat is a scammer rewording, not a false positive.+export const MODERATION_STRIKES_BEFORE_BAN = 3;+export const MODERATION_STRIKE_WINDOW = "24 h";++// Model calls a user may spend in one window. Only content that trips the+// prefilter reaches the model, so this bounds the OpenAI bill for one+// account at a few cents a day. Nobody legitimate writes this many polls+// with links, emails or phone numbers in them.+export const MODERATION_AI_CALLS_PER_DAY = 50;diff --git a/apps/web/src/features/moderation/mutations.ts b/apps/web/src/features/moderation/mutations.tsindex 019e8472f..c0955c649 100644--- a/apps/web/src/features/moderation/mutations.ts+++ b/apps/web/src/features/moderation/mutations.ts@@ -6,7 +6,14 @@ import { createLogger } from "@rallly/logger";import { generateText } from "ai";import { after } from "next/server";import { env } from "@/env";+import { cancelUserSubscriptions } from "@/features/billing/mutations";import { banUser } from "@/features/user/mutations";+import { createRatelimit } from "@/lib/rate-limit";+import {+ MODERATION_AI_CALLS_PER_DAY,+ MODERATION_STRIKE_WINDOW,+ MODERATION_STRIKES_BEFORE_BAN,+} from "./constants";import type { ModerationResult, ModerationVerdict } from "./types";import { containsSuspiciousPatterns } from "./utils";@@ -93,24 +100,96 @@ const safeResult: ModerationResult = {reason: "",};+// One point per flagged verdict. The limiter is a counter here, not a gate:+// the request that spends the last point is the one that bans.+const strikes = createRatelimit(+ MODERATION_STRIKES_BEFORE_BAN,+ MODERATION_STRIKE_WINDOW,+);++const aiBudget = createRatelimit(MODERATION_AI_CALLS_PER_DAY, "24 h");++// True when this user may spend another model call today. A store failure+// allows the call: the budget is a cost cap, not a security boundary.+async function withinAiBudget(userId: string) {+ try {+ const budget = await aiBudget?.limit(`moderation-ai:${userId}`);+ return budget?.success ?? true;+ } catch (error) {+ logger.error({ error, userId }, "Could not read moderation AI budget");+ return true;+ }+}++// A banned scammer's next move is a chargeback, which costs more than the+// subscription, so the ban and the cancellation are one step. A Stripe+// failure is logged and never undoes the ban. Shared with the control+// panel's manual ban, which is the same decision made by a person.+export async function banUserForAbuse({+ userId,+ reason,+}: {+ userId: string;+ reason: string;+}) {+ await banUser({ userId, reason });+ try {+ await cancelUserSubscriptions({ userId });+ } catch (error) {+ logger.error(+ { error, userId },+ "User banned but their subscriptions could not be cancelled",+ );+ }+}++async function recordStrike(userId: string) {+ let strike: Awaited<ReturnType<NonNullable<typeof strikes>["limit"]>> | null;+ try {+ strike = (await strikes?.limit(`moderation:${userId}`)) ?? null;+ } catch (error) {+ // The store is a counter here, not a gate: losing a strike is better+ // than losing the support email that follows.+ logger.error({ error, userId }, "Could not record moderation strike");+ strike = null;+ }+ if (!strike) {+ return { count: null, banned: false };+ }+ const count = strike.success+ ? MODERATION_STRIKES_BEFORE_BAN - strike.remainingPoints+ : MODERATION_STRIKES_BEFORE_BAN;+ const banned = count >= MODERATION_STRIKES_BEFORE_BAN;+ if (banned) {+ logger.warn({ userId, count }, "Moderation strike limit reached, banning");+ await banUserForAbuse({+ userId,+ reason: `Automatic ban: ${count} pieces of content flagged by moderation within ${MODERATION_STRIKE_WINDOW}`,+ });+ }+ return { count, banned };+}+/*** Moderates content to detect spam, inappropriate content, or abuse* Uses a two-layer approach:* 1. Pattern-based detection for common spam patterns* 2. AI-based moderation for more sophisticated content analysis*+ * A flagged verdict always blocks. Paid users are not exempt: the two most+ * recent abuse cases were Pro subscriptions, and no flag in the last 90+ * days was a false positive. Repeated flags ban the user (see recordStrike).+ ** @returns Moderation result with verdict and explanation*/export async function moderateContent({userId,userEmail,content,- trusted = false,}: {userId: string;- userEmail: string;+ userEmail?: string;content: Record<string, string>;- trusted?: boolean;}): Promise<ModerationResult> {// Skip moderation if the feature is disabled in environmentif (env.MODERATION_ENABLED !== "true") {@@ -134,7 +213,7 @@ export async function moderateContent({if (containsBannedDomain(textToModerate)) {logger.warn({ userId }, "Banned domain detected, banning user");after(() =>- banUser({+ banUserForAbuse({userId,reason: "Automatic ban: banned domain detected in content",}),@@ -150,6 +229,20 @@ export async function moderateContent({// If suspicious patterns are found, perform AI moderationif (hasSuspiciousPatterns) {+ // Fail closed for suspicious content only: clean content never reaches+ // this branch, so an exhausted budget blocks nothing a legitimate user+ // writes at that volume.+ if (!(await withinAiBudget(userId))) {+ logger.warn(+ { userId },+ "Moderation AI budget exhausted, flagging without a model call",+ );+ return {+ verdict: "flagged",+ reason: `More than ${MODERATION_AI_CALLS_PER_DAY} pieces of suspicious content in 24 hours`,+ };+ }+logger.info("Suspicious patterns detected, performing AI moderation check");try {const result = await moderateContentWithAI(textToModerate);@@ -159,29 +252,25 @@ export async function moderateContent({{ userId, verdict: result.verdict, reason: result.reason },`Content ${result.verdict} by AI moderation`,);- after(() =>- sendRawEmail({+ after(async () => {+ const strike = await recordStrike(userId);+ await sendRawEmail({to: env.SUPPORT_EMAIL,- subject: `Content ${result.verdict} by moderation`,+ subject: strike.banned+ ? "User banned after repeated flagged content"+ : `Content ${result.verdict} by moderation`,text: [`User ID: ${userId}`,- `User Email: ${userEmail}`,- `Trusted: ${trusted ? "Yes" : "No"}`,+ `User Email: ${userEmail ?? "unknown"}`,+ `Strike: ${strike.count ?? "not counted"} of ${MODERATION_STRIKES_BEFORE_BAN}`,+ `Banned: ${strike.banned ? "Yes" : "No"}`,`Verdict: ${result.verdict}`,`Reason: ${result.reason}`,"--------------------------------",textToModerate,].join("\n\n"),- }),- );-- if (trusted) {- logger.info(- { userId },- "Content flagged but user is trusted, allowing through",- );- return safeResult;- }+ });+ });}return result;diff --git a/apps/web/src/features/user/actions.ts b/apps/web/src/features/user/actions.tsindex 38a0f9e04..676361d9d 100644--- a/apps/web/src/features/user/actions.ts+++ b/apps/web/src/features/user/actions.ts@@ -6,7 +6,7 @@ import { headers } from "next/headers";import * as z from "zod";import { avatarAssetProfile } from "@/features/user/constants";import { isEmailTaken } from "@/features/user/data";-import { banUser, unbanUser, updateUserRole } from "@/features/user/mutations";+import { unbanUser, updateUserRole } from "@/features/user/mutations";import authLib from "@/lib/auth";import { timeFormatSchema, weekStartSchema } from "@/lib/datetime/schema";import { AppError } from "@/lib/errors/app-error";@@ -198,45 +198,6 @@ export const changeRoleAction = adminActionClientawait updateUserRole({ userId: targetUser.id, role });});-export const banUserAction = adminActionClient- .metadata({ actionName: "ban_user" })- .inputSchema(- z.object({- userId: z.string(),- reason: z.string().trim().max(500).optional(),- }),- )- .action(async ({ ctx, parsedInput }) => {- const { userId, reason } = parsedInput;-- const targetUser = await prisma.user.findUnique({- where: { id: userId },- });-- if (!targetUser) {- throw new AppError({- code: "NOT_FOUND",- message: `User ${userId} not found`,- });- }-- if (targetUser.banned) {- throw new AppError({- code: "FORBIDDEN",- message: "User is already banned",- });- }-- if (ctx.ability.cannot("update", subject("User", targetUser), "banned")) {- throw new AppError({- code: "UNAUTHORIZED",- message: "Current user is not authorized to ban this user",- });- }-- await banUser({ userId, reason: reason || undefined });- });-export const unbanUserAction = adminActionClient.metadata({ actionName: "unban_user" }).inputSchema(diff --git a/apps/web/src/features/user/mutations.ts b/apps/web/src/features/user/mutations.tsindex 4d0c66a78..ee3348ae5 100644--- a/apps/web/src/features/user/mutations.ts+++ b/apps/web/src/features/user/mutations.ts@@ -78,7 +78,9 @@ export async function updateUserRole({// session expires. The admin plugin's banUser endpoint is deliberately not// used: it authorizes against the caller's session snapshot rather than the// database, and the moderation auto-ban runs without an admin session at all.-// Authorization is the caller's responsibility.+// Authorization is the caller's responsibility. Callers that ban for abuse+// also cancel the user's subscriptions; billing cannot be imported here+// without a feature cycle.export async function banUser({userId,diff --git a/apps/web/src/trpc/routers/polls.ts b/apps/web/src/trpc/routers/polls.tsindex 7f7217aa4..51b017c59 100644--- a/apps/web/src/trpc/routers/polls.ts+++ b/apps/web/src/trpc/routers/polls.ts@@ -132,8 +132,6 @@ export const polls = router({});}- const isPro = activeSpace?.tier === "pro";-const moderation = await moderateContent({userId: ctx.user.id,userEmail: ctx.user.email,@@ -142,7 +140,6 @@ export const polls = router({Description: input.description || "",Location: input.location || "",},- trusted: isPro,});if (moderation.verdict !== "safe") {@@ -335,11 +332,6 @@ export const polls = router({});}- const activeSpace = ctx.user.isGuest- ? null- : await getActiveSpaceForUser(ctx.user.id);- const isPro = activeSpace?.tier === "pro";-const moderation = await moderateContent({userId: ctx.user.id,userEmail: ctx.user.email,@@ -348,7 +340,6 @@ export const polls = router({Description: input.description || "",Location: input.location || "",},- trusted: isPro,});if (moderation.verdict !== "safe") {