0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-28 05:58:43 +02:00
silverwind 311aac4acb
Skip sole-owner removal during group sync instead of aborting login
Even with the add/remove dedup in place, a user who is no longer in any
group that maps to Owners but is the sole owner of the org still hits
ErrLastOrgOwner during sync, which aborts OAuth login. Catch that one
error in syncGroupsToTeamsCached, log a warning, and continue — the org
invariant is preserved, login succeeds, and the next sync converges
after an admin promotes another owner.

Also iterate membershipsToRemove (not membershipsToAdd) in the dedup
loop so we skip set allocation when an org has no removes, and add a
dedicated test plus a post-sync owner-membership assertion in the
existing test.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
2026-04-23 12:26:25 +02:00
..