diff options
author | Giteabot <teabot@gitea.io> | 2024-02-25 00:42:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-24 17:42:33 +0100 |
commit | f98a1b851c0c918439e6f9c60afcd7cc7f4b0b9f (patch) | |
tree | 3ff7cf12dda834dfacc2ed39d1b78ba7ae5e7e06 /models/repo/user_repo.go | |
parent | e75594f7a616644b011e3632692f2bf0d6eb709f (diff) | |
download | gitea-f98a1b851c0c918439e6f9c60afcd7cc7f4b0b9f.tar.gz gitea-f98a1b851c0c918439e6f9c60afcd7cc7f4b0b9f.zip |
Users with `read` permission of pull requests can be assigned too (#27263) (#29372)
Backport #27263 by @lunny
This PR will also keep the consistent between list assigned users and
check assigned users.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/repo/user_repo.go')
-rw-r--r-- | models/repo/user_repo.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/models/repo/user_repo.go b/models/repo/user_repo.go index dd2ef62201..30c9db7474 100644 --- a/models/repo/user_repo.go +++ b/models/repo/user_repo.go @@ -8,6 +8,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/perm" + "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/container" api "code.gitea.io/gitea/modules/structs" @@ -78,7 +79,8 @@ func GetRepoAssignees(ctx context.Context, repo *Repository) (_ []*user_model.Us if err = e.Table("team_user"). Join("INNER", "team_repo", "`team_repo`.team_id = `team_user`.team_id"). Join("INNER", "team_unit", "`team_unit`.team_id = `team_user`.team_id"). - Where("`team_repo`.repo_id = ? AND `team_unit`.access_mode >= ?", repo.ID, perm.AccessModeWrite). + Where("`team_repo`.repo_id = ? AND (`team_unit`.access_mode >= ? OR (`team_unit`.access_mode = ? AND `team_unit`.`type` = ?))", + repo.ID, perm.AccessModeWrite, perm.AccessModeRead, unit.TypePullRequests). Distinct("`team_user`.uid"). Select("`team_user`.uid"). Find(&additionalUserIDs); err != nil { |