Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔒️ Relax content policy (#2201)

Luke Vellab1d38213b649
diff --git a/apps/web/src/features/moderation/index.ts b/apps/web/src/features/moderation/index.ts
index dcbc6ac5b..025bc18c9 100644
--- a/apps/web/src/features/moderation/index.ts
+++ b/apps/web/src/features/moderation/index.ts
@@ -57,7 +57,7 @@ export async function moderateContent({
try {
const result = await moderateContentWithAI(textToModerate);
- if (result.verdict === "flagged" || result.verdict === "suspicious") {
+ if (result.verdict === "flagged") {
logger.warn(
{ userId, verdict: result.verdict, reason: result.reason },
`Content ${result.verdict} by AI moderation`,
@@ -71,7 +71,7 @@ export async function moderateContent({
`User ID: ${userId}`,
`Verdict: ${result.verdict}`,
`Reason: ${result.reason}`,
- "Content:",
+ "--------------------------------",
textToModerate,
].join("\n\n"),
}),
diff --git a/apps/web/src/features/moderation/libs/ai-moderation.ts b/apps/web/src/features/moderation/libs/ai-moderation.ts
index 282b9135f..d6cf29182 100644
--- a/apps/web/src/features/moderation/libs/ai-moderation.ts
+++ b/apps/web/src/features/moderation/libs/ai-moderation.ts
@@ -4,7 +4,7 @@ import { generateText } from "ai";
const logger = createLogger("moderation/ai");
-export type ModerationVerdict = "flagged" | "suspicious" | "safe";
+export type ModerationVerdict = "flagged" | "safe";
export type ModerationResult = {
verdict: ModerationVerdict;
@@ -27,23 +27,20 @@ export async function moderateContentWithAI(
role: "system",
content: `You are a content moderator for a scheduling and polling application. Users create polls about any topic — finding meeting times, making group decisions, voting on proposals, etc. Content may be in any language.
-Respond with one of three verdicts:
-- FLAGGED: Content is clearly abusive and should be blocked. Use this for:
- - Phishing or scams: fake account notifications, brand impersonation (e.g. Binance, Coinbase, PayPal), "your balance/funds/account" language, urgency tactics to click external links
+Respond with one of two verdicts:
+- FLAGGED: Content is clearly abusive and harmful to the platform. Use this for:
+ - Phishing or scams: fake account notifications, brand impersonation
- Financial fraud: fake crypto mining, investment scams, unclaimed funds, lottery winnings
- Illegal activities: drugs, prostitution, illegal gambling
- - Spam relay: content that is not a genuine poll but a mass marketing message, advertisement, or message blast using the platform as a delivery mechanism
-
-- SUSPICIOUS: Content shows some indicators of harmful intent (e.g. partial scam language, obfuscated links) but not enough to conclusively block. Use this for borderline cases that warrant human review.
- SAFE: Content is not harmful.
-Do NOT flag or mark as suspicious content because:
+Do NOT flag content because:
- It is in a non-English language
- It is short, brief, or lacks detail
+- It is ambiguous or unclear
-When in doubt between FLAGGED and SUSPICIOUS, choose SUSPICIOUS.
-When in doubt between SUSPICIOUS and SAFE, choose SAFE.
+When in doubt, choose SAFE.
Respond in exactly this format:
VERDICT
@@ -60,8 +57,6 @@ Brief explanation of why this verdict was chosen.`,
let verdict: ModerationVerdict = "safe";
if (verdictLine.includes("FLAGGED")) {
verdict = "flagged";
- } else if (verdictLine.includes("SUSPICIOUS")) {
- verdict = "suspicious";
}
return { verdict, reason };
diff --git a/apps/web/src/features/moderation/libs/pattern-moderation.ts b/apps/web/src/features/moderation/libs/pattern-moderation.ts
index 12495406e..67ad5c999 100644
--- a/apps/web/src/features/moderation/libs/pattern-moderation.ts
+++ b/apps/web/src/features/moderation/libs/pattern-moderation.ts
@@ -8,7 +8,7 @@ export function containsSuspiciousPatterns(text: string) {
// Define all patterns
const repetitiveCharsPattern = /(.)\1{4,}/;
- const allCapsPattern = /[A-Z]{5,}/;
+ const allCapsPattern = /[A-Z]{10,}/;
const excessiveSpecialCharsPattern =
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]{4,}/;
const suspiciousUrlPattern =
@@ -35,7 +35,7 @@ export function containsSuspiciousPatterns(text: string) {
// Raw HTTP(S) URLs — but exclude common meeting/location domains
const rawUrlPattern = /https?:\/\/[^\s]+/i;
const safeUrlPattern =
- /https?:\/\/([\w-]+\.)?(zoom\.us|meet\.google\.com|teams\.microsoft\.com|maps\.(google|apple)\.com|calendar\.google\.com|docs\.google\.com|whereby\.com|cal\.com|calendly\.com)[^\s]*/i;
+ /https?:\/\/([\w-]+\.)?(zoom\.us|meet\.google\.com|teams\.microsoft\.com|maps\.(google|apple)\.com|chat\.whatsapp\.com|wa\.me|t\.me|discord\.(gg|com))[^\s]*/i;
const hasUnsafeUrl = rawUrlPattern.test(text) && !safeUrlPattern.test(text);