submission-receive: name the disallowed phrase in error + support link

422 response now reads "Your submission contains disallowed phrase X.
Please remove it and try again. Questions? Email
support@relevantmediaproperties.com." so PR firms know exactly what
tripped the filter without having to ask.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ryan Salazar
2026-05-28 14:39:37 +00:00
parent b3ec895c50
commit e163746d87

View File

@@ -39,11 +39,17 @@ export async function POST(request: NextRequest) {
// Editorial guardrail: reject anything mentioning a disallowed phrase
// (competitor publications, banned exhibitors, etc.) before it ever lands
// in bb.native_articles.
// in bb.native_articles. The error names the specific phrase(s) so the
// submitter knows what to edit, and points them at support for context.
const violations = await findViolations(`${title}\n${content}`);
if (violations.length > 0) {
const phraseList = violations.map((v) => `"${v.phrase}"`).join(', ');
return NextResponse.json(
{ error: 'Submission rejected: contains disallowed phrases', violations },
{
error: `Your submission contains disallowed phrase${violations.length > 1 ? 's' : ''}: ${phraseList}. Please remove ${violations.length > 1 ? 'them' : 'it'} and try again. Questions? Email support@relevantmediaproperties.com.`,
violations,
support_email: 'support@relevantmediaproperties.com',
},
{ status: 422 },
);
}