Improve handling of failed moderation bypasses for elite accounts

Update relay.ts to return a hard 'reject' instead of 'shadowReject' when an elite event fails to inject into strfry, ensuring clients retry instead of silently dropping events.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: ddd878c8-77fd-4ad2-852d-2644c94b18da
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9f85e954-647c-46a5-90a7-396e495a805a/418bf6f8-212b-4bb0-a7a5-8231a061da4e/Q83Uqvu
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
alexpaynex
2026-03-19 20:38:51 +00:00
parent a95fd76ebd
commit f5c2c7e8c2

View File

@@ -193,15 +193,17 @@ async function evaluatePolicy(
}
if (isElite) {
// Elite accounts bypass moderation — inject directly into strfry
// Elite accounts bypass moderation — inject directly into strfry.
// On inject failure, return hard reject so the client knows to retry
// (shadowReject would silently drop the event from the sender's perspective).
const rawJson = JSON.stringify(rawEvent);
const injectResult = await injectEvent(rawJson);
if (!injectResult.ok) {
logger.warn("elite event inject failed — shadowReject as fallback", {
logger.warn("elite event inject failed — returning reject so client can retry", {
eventId: eventId.slice(0, 8),
error: injectResult.error,
});
return shadowRejectDecision(eventId);
return rejectDecision(eventId, "relay unavailable — please retry");
}
return acceptDecision(eventId);
}