Skip to content

Commit 209045f

Browse files
authored
Slight simplification of accessibleRepositoryCondition (#10875)
* Slight simplification of accessibleRepositoryCondition Signed-off-by: Andrew Thornton <[email protected]>
1 parent ad40264 commit 209045f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

models/repo_list.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,12 @@ func accessibleRepositoryCondition(user *User) builder.Cond {
353353
// 1. Be able to see all non-private repositories that either:
354354
cond = cond.Or(builder.And(
355355
builder.Eq{"`repository`.is_private": false},
356-
builder.Or(
357-
// A. Aren't in organisations __OR__
358-
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.Eq{"type": UserTypeOrganization})),
359-
// B. Isn't a private organisation. Limited is OK as long as we're logged in.
360-
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.In("visibility", orgVisibilityLimit))))))
356+
// 2. Aren't in an private organisation or limited organisation if we're not logged in
357+
builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(
358+
builder.And(
359+
builder.Eq{"type": UserTypeOrganization},
360+
builder.In("visibility", orgVisibilityLimit)),
361+
))))
361362
}
362363

363364
if user != nil {

0 commit comments

Comments
 (0)