Fix org team assignee/reviewer lookups for team member permissions#37365
Fix org team assignee/reviewer lookups for team member permissions#37365silverwind merged 14 commits intogo-gitea:mainfrom
Conversation
|
The proper fix should use |
6d8aae4 to
87f18e7
Compare
|
Updated per review: dropped the migration entirely and refactored Two calls preserve the previous condition (write to any unit + read on PullRequests). Existing |
|
Used Happy to move |
… helpers `GetRepoAssignees`, `GetOrgAssignees` and `services/pull.GetReviewers` all collected org team members by joining `team_user` directly against `team_unit` and filtering on `team_unit.access_mode`. On instances where some `team_unit` rows ended up with `access_mode = 0` — observed on databases that were upgraded across several releases — members of the affected team (typically the `Owners` team) were silently dropped from: * @mention autocomplete in issues and pull requests * assignee / reviewer selection (per-repo and org-level project boards) * email notifications triggered by mentions This matches the symptoms reported in go-gitea#34871. Replace each ad-hoc join with the existing helper `organization.GetTeamUserIDsWithAccessToAnyRepoUnit`, whose query already handles both sources of truth via `team.authorize >= ? OR team_unit.access_mode >= ?`. For the org-wide path (`GetOrgAssignees`) add a matching helper `GetTeamUserIDsWithAccessToAnyRepoUnitInOrg` that applies the same OR logic without a per-repo scope. Also fix a pre-existing guard in `GetOrgAssignees` that skipped the final user lookup whenever direct-access users were empty but team-based users were not. No schema changes; behaviour for healthy instances is identical (the helper's OR is a superset of the previous condition, but on healthy data the two branches match). `TestRepoAssignees`, `TestRepoGetReviewers` and `TestRepoGetReviewerTeams` continue to pass locally. Signed-off-by: Jakub Pisarczyk <pisarz77@gmail.com>
87f18e7 to
e009eb2
Compare
|
Good catch — the same raw
Also picked up a pre-existing guard in
|
|
The changed What if user-a has no access to repo-1? Actually the design here is totally a mess and no clear fix:
|
|
To make things simple, it can simpliy list all org members for the "project assignee list" |
|
OK, even simpler, since you already have all issues for all project columns, so you should already be able to know all assignees here. |
- Add TestRepoAssigneesIncludesOwnerTeamWithZeroUnitAccessMode covering the case where team.authorize=Owner and team_unit.access_mode=0 - Note at both call sites that the helper matches via team.authorize - Fix ServerError label to match function name Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
Some cleanups and a test in b7ccc56. |
Pull request was converted to draft
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
…37365) (#37391) Backport #37365 by @pisarz77 Fix team members missing from assignee list when `team_unit.access_mode` is 0 but the doer is owner. Fix #34871 1. Use `GetTeamUserIDsWithAccessToAnyRepoUnit` for repo assignee list 2. Load assignee list for project issues directly 3. Use `GetTeamUserIDsWithAccessToAnyRepoUnit` for repo reviewer list Signed-off-by: Jakub Pisarczyk <pisarz77@gmail.com> Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: pisarz77 <pisarz77@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
* origin/main: Allow fast-forward-only merge when signed commits are required (go-gitea#37335) Introduce `ActionRunAttempt` to represent each execution of a run (go-gitea#37119) Move review request functions to a standalone file (go-gitea#37358) Fix repo init README EOL (go-gitea#37388) Fix org team assignee/reviewer lookups for team member permissions (go-gitea#37365) Remove external service dependencies in migration tests (go-gitea#36866) Extend issue context popup beyond markdown content (go-gitea#36908) # Conflicts: # routers/api/v1/repo/action.go # web_src/js/components/RepoActionView.vue
* origin/main: (127 commits) Refactor pull request view (1) (go-gitea#37380) Improve AGENTS.md (go-gitea#37382) Remove dead CSS (go-gitea#37376) Add pr-review e2e test and speed up e2e tests (go-gitea#37345) Drop Fomantic tab, checkbox and form patches (go-gitea#37377) fix: dump with default zip type produces uncompressed zip (go-gitea#37401) Allow fast-forward-only merge when signed commits are required (go-gitea#37335) Introduce `ActionRunAttempt` to represent each execution of a run (go-gitea#37119) Move review request functions to a standalone file (go-gitea#37358) Fix repo init README EOL (go-gitea#37388) Fix org team assignee/reviewer lookups for team member permissions (go-gitea#37365) Remove external service dependencies in migration tests (go-gitea#36866) Extend issue context popup beyond markdown content (go-gitea#36908) fix: commit status reporting (go-gitea#37372) Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356) Fix cmd tests by mocking builtin paths (go-gitea#37369) chore: upgrade Go version in devcontainer image to 1.26 (go-gitea#37374) Fix button layout shift when collapsing file tree in editor (go-gitea#37363) Update `Block a user` form (go-gitea#37359) Remove IsValidExternalURL/IsAPIURL and use IsValidURL at call sites (go-gitea#37364) ... # Conflicts: # modules/eventsource/event.go # tests/e2e/events.test.ts
* origin/main: (51 commits) Fix color regressions, add `priority` color (go-gitea#37417) [skip ci] Updated translations via Crowdin Stabilize e2e logout propagation test (go-gitea#37403) refactor: serve site manifest via `/assets/site-manifest.json` endpoint (go-gitea#37405) feat(security): set X-Content-Type-Options: nosniff by default (go-gitea#37354) Refactor pull request view (1) (go-gitea#37380) Improve AGENTS.md (go-gitea#37382) Remove dead CSS (go-gitea#37376) Add pr-review e2e test and speed up e2e tests (go-gitea#37345) Drop Fomantic tab, checkbox and form patches (go-gitea#37377) fix: dump with default zip type produces uncompressed zip (go-gitea#37401) Allow fast-forward-only merge when signed commits are required (go-gitea#37335) Introduce `ActionRunAttempt` to represent each execution of a run (go-gitea#37119) Move review request functions to a standalone file (go-gitea#37358) Fix repo init README EOL (go-gitea#37388) Fix org team assignee/reviewer lookups for team member permissions (go-gitea#37365) Remove external service dependencies in migration tests (go-gitea#36866) Extend issue context popup beyond markdown content (go-gitea#36908) fix: commit status reporting (go-gitea#37372) Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356) ...

Fix team members missing from assignee list when
team_unit.access_modeis 0 but the doer is owner.Fix #34871
GetTeamUserIDsWithAccessToAnyRepoUnitfor repo assignee listGetTeamUserIDsWithAccessToAnyRepoUnitfor repo reviewer list