From cddd9b6e3c72f3028a3cdb3fe529bf92fe7093b2 Mon Sep 17 00:00:00 2001 From: inference-bot Date: Fri, 2 Oct 2026 08:41:03 -0600 Subject: [PATCH] Loomio username fix: allow hyphens in uids (was falling through to email local-part for inference-admin/bot) --- app/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 05e686e..ee9122f 100644 --- a/app/main.py +++ b/app/main.py @@ -797,10 +797,11 @@ async def loomio_fix_usernames(client: httpx.AsyncClient) -> dict: for ident in u.get("identities") or []: if ident.get("identity_type") == "oauth" and ident.get("uid"): uid = ident["uid"].lower() - # Loomio usernames: lowercase letters, numbers, underscores only. - if uid.replace("_", "").isalnum() and len(uid) >= 2: + # Loomio usernames allow lowercase letters, numbers, underscores and hyphens. + if uid.replace("_", "").replace("-", "").isalnum() and len(uid) >= 2: target = uid break + # uid unusable (dots etc) — use email local-part instead target = (u.get("email") or "").split("@")[0].lower() or None break if not target and u.get("email") and "@" in u["email"]: