mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Don't return duplicated users who can create org repo (#22560)
- Currently the function `GetUsersWhoCanCreateOrgRepo` uses a query that
is able to have duplicated users in the result, this is can happen under
the condition that a user is in team that either is the owner team or
has permission to create organization repositories.
- Add test code to simulate the above condition for user 3,
[`TestGetUsersWhoCanCreateOrgRepo`](a1fcb1cfb8/models/organization/org_test.go (L435)
)
is the test function that tests for this.
- The fix is quite trivial use a map keyed by user id in order to drop
duplicates.
---------
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@@ -140,3 +140,14 @@
|
||||
num_members: 1
|
||||
includes_all_repositories: false
|
||||
can_create_org_repo: false
|
||||
|
||||
-
|
||||
id: 14
|
||||
org_id: 3
|
||||
lower_name: teamcreaterepo
|
||||
name: teamCreateRepo
|
||||
authorize: 2 # write
|
||||
num_repos: 0
|
||||
num_members: 1
|
||||
includes_all_repositories: false
|
||||
can_create_org_repo: true
|
||||
|
@@ -93,3 +93,9 @@
|
||||
org_id: 19
|
||||
team_id: 6
|
||||
uid: 31
|
||||
|
||||
-
|
||||
id: 17
|
||||
org_id: 3
|
||||
team_id: 14
|
||||
uid: 2
|
||||
|
@@ -104,7 +104,7 @@
|
||||
num_following: 0
|
||||
num_stars: 0
|
||||
num_repos: 3
|
||||
num_teams: 4
|
||||
num_teams: 5
|
||||
num_members: 3
|
||||
visibility: 0
|
||||
repo_admin_change_team_access: false
|
||||
|
Reference in New Issue
Block a user