Skip to content

Conversation

@bokelley
Copy link
Contributor

@bokelley bokelley commented Jan 7, 2026

Summary

  • Fixed duplicate members appearing in chapter/working group member lists when users belong to multiple organizations
  • Fixed leader actions (Manage Posts button, etc.) not appearing for leaders because user ID wasn't being sent to the frontend

Root Cause

Bug 1 - Duplicate Members: SQL queries in working-group-db.ts used LEFT JOIN organization_memberships which returned multiple rows when a user belongs to multiple organizations. David Porzelt appeared twice because he's a member of 2 organizations.

Bug 2 - Missing Leader Actions: The /api/config endpoint wasn't returning the user's id field. The frontend checks currentUser.id === leader.user_id, but currentUser.id was always undefined.

Changes

  • server/src/db/working-group-db.ts: Changed plain LEFT JOIN organization_memberships to LEFT JOIN LATERAL ... LIMIT 1 in three queries:

    • getMembershipsByWorkingGroup()
    • getLeaders()
    • getLeadersBatch()
  • server/src/http.ts: Added id: req.user.id to the /api/config response

Test plan

  • All existing tests pass (187 unit tests)
  • Build succeeds
  • Verified API returns user ID via browser testing
  • Code review found no critical issues

🤖 Generated with Claude Code

…pages

Fixed two issues reported by David Porzelt on the German chapter page:

1. Duplicate members in chapter lists - Users belonging to multiple
   organizations appeared multiple times due to a SQL JOIN that returned
   multiple rows per user. Fixed by using LEFT JOIN LATERAL with LIMIT 1
   to ensure only one organization membership row per user.

2. Leader actions not working - The /api/config endpoint was not returning
   the user's ID, causing the frontend leader check to always fail since
   currentUser.id was undefined. Added id field to the response.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@bokelley bokelley merged commit ecd9fc6 into main Jan 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants