Skip to content

Commit 11ef70a

Browse files
committed
Fix access condition expression
1 parent 4af3945 commit 11ef70a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/repo_list.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos RepositoryList, _ in
178178
// Include collaborative repositories
179179
if opts.Collaborate {
180180
// Add repositories where user is set as collaborator directly
181-
accessCond = accessCond.Or(builder.Expr("id IN (SELECT repo_id FROM `access` WHERE access.user_id = ? AND owner_id != ?)",
182-
opts.OwnerID, opts.OwnerID))
181+
accessCond = accessCond.Or(builder.And(
182+
builder.Expr("id IN (SELECT repo_id FROM `access` WHERE access.user_id = ?)", opts.OwnerID),
183+
builder.Neq{"owner_id": opts.OwnerID}))
183184
}
184185

185186
// Add user access conditions to search

0 commit comments

Comments
 (0)