forked from forgejo/forgejo
In code search, get code unit accessible repos in one (main) query (#19764)
* When non-admin users use code search, get code unit accessible repos in one main query * Modified some comments to match the changes * Removed unnecessary check for Access Mode in Collaboration table Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
881646520e
commit
6473bd333a
5 changed files with 113 additions and 114 deletions
|
@ -1430,7 +1430,7 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *organizati
|
|||
cond = cond.And(
|
||||
builder.Or(
|
||||
repo_model.UserOwnedRepoCond(userID), // owned repos
|
||||
repo_model.UserCollaborationRepoCond(repoIDstr, userID), // collaboration repos
|
||||
repo_model.UserAccessRepoCond(repoIDstr, userID), // user can access repo in a unit independent way
|
||||
repo_model.UserAssignedRepoCond(repoIDstr, userID), // user has been assigned accessible public repos
|
||||
repo_model.UserMentionedRepoCond(repoIDstr, userID), // user has been mentioned accessible public repos
|
||||
repo_model.UserCreateIssueRepoCond(repoIDstr, userID, isPull), // user has created issue/pr accessible public repos
|
||||
|
@ -1499,7 +1499,7 @@ func GetRepoIDsForIssuesOptions(opts *IssuesOptions, user *user_model.User) ([]i
|
|||
|
||||
opts.setupSessionNoLimit(sess)
|
||||
|
||||
accessCond := repo_model.AccessibleRepositoryCondition(user)
|
||||
accessCond := repo_model.AccessibleRepositoryCondition(user, unit.TypeInvalid)
|
||||
if err := sess.Where(accessCond).
|
||||
Distinct("issue.repo_id").
|
||||
Table("issue").
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue