org links: members table has no name column — drop it from org SQL/unpackings (names come from OC/Cloudron)

This commit is contained in:
inference-bot committed 2026-10-20 22:55:55 -06:00
1 parent 72614f8f19
commit 394cccfbcb
1 file changed
+6 -6
+6 -6
View File
@@ -1996,11 +1996,11 @@ async def opencollective_webhook(request: Request, token: str):
# dues; unlinked orgs ping the operator to link them.
conn = get_db()
row = conn.execute(
"SELECT email, name FROM members WHERE org_slug = ?", (slug,)
"SELECT email, org_slug FROM members WHERE org_slug = ?", (slug,)
).fetchone()
conn.close()
if row:
org_email, org_name = row
org_email, org_slug_col = row
conn = get_db()
conn.execute("UPDATE members SET active = 1 WHERE email = ?", (org_email,))
conn.commit()
@@ -2373,7 +2373,7 @@ async def admin_org_link(request: Request):
conn = get_db()
existing = conn.execute("SELECT email FROM members WHERE org_slug = ?", (org_slug,)).fetchone()
conn.execute(
"INSERT INTO members (email, name, slug, active, org_slug) VALUES (?, ?, ?, 1, ?) "
"INSERT INTO members (email, slug, active, org_slug) VALUES (?, ?, 1, ?) "
"ON CONFLICT(email) DO UPDATE SET org_slug = excluded.org_slug, active = 1",
(email, name, org_slug, org_slug),
)
@@ -3152,17 +3152,17 @@ async def reconcile_memberships() -> dict:
if org_backers or not org_fetch_ok:
conn = get_db()
org_rows = conn.execute(
"SELECT email, name, org_slug FROM members WHERE org_slug IS NOT NULL"
"SELECT email, org_slug FROM members WHERE org_slug IS NOT NULL"
).fetchall()
conn.close()
for org_email, org_name, org_slug in org_rows:
for org_email, org_slug in org_rows:
org = org_backers.get(org_slug)
if org_fetch_ok and not org:
continue # org lapsed → falls through to deactivation below
if org_email not in active_emails:
active.append({
"email": org_email,
"name": org_name or (org["name"] if org else org_slug),
"name": (org or {}).get("name") or org_slug,
"slug": org_slug,
"role": (org or {}).get("role", "BACKER"),
"tier": ((org or {}).get("tier", "") or "") + " (org)",