diff --git a/app/main.py b/app/main.py index 13075c5..7e8dba6 100644 --- a/app/main.py +++ b/app/main.py @@ -4738,9 +4738,14 @@ async def admin_guest_resend_stale(request: Request): body = await request.json() if request.headers.get("content-type", "").startswith("application/json") else {} days = int(body.get("days") or 7) conn = get_db() + # Skip anyone we emailed in the last hour: a single invite can otherwise be + # resent twice (an explicit resend followed by the sweep — violet@hypha.coop, + # 2026-11-17). emails = [r[0] for r in conn.execute( "SELECT DISTINCT lower(g.recipient_email) FROM guests g " + "LEFT JOIN members m ON lower(m.email) = lower(g.recipient_email) " "WHERE g.status = 'active' AND g.created_at <= datetime('now', ?) " + "AND (m.welcome_sent_at IS NULL OR m.welcome_sent_at <= datetime('now', '-1 hour')) " "ORDER BY g.created_at", (f"-{days} days",)).fetchall()] conn.close() results = []