mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
[BugFix] Hide public repos owned by private orgs (#9609)
* Restrict AllPublic to actually public repos. * Add new parameter to add in AllLimited Repos
This commit is contained in:
@@ -121,7 +121,8 @@ type SearchRepoOptions struct {
|
||||
StarredByID int64
|
||||
Page int
|
||||
IsProfile bool
|
||||
AllPublic bool // Include also all public repositories
|
||||
AllPublic bool // Include also all public repositories of users and public organisations
|
||||
AllLimited bool // Include also all public repositories of limited organisations
|
||||
PageSize int // Can be smaller than or equal to setting.ExplorePagingNum
|
||||
// None -> include collaborative AND non-collaborative
|
||||
// True -> include just collaborative
|
||||
@@ -228,7 +229,11 @@ func SearchRepository(opts *SearchRepoOptions) (RepositoryList, int64, error) {
|
||||
}
|
||||
|
||||
if opts.AllPublic {
|
||||
accessCond = accessCond.Or(builder.Eq{"is_private": false})
|
||||
accessCond = accessCond.Or(builder.Eq{"is_private": false}.And(builder.In("owner_id", builder.Select("`user`.id").From("`user`").Where(builder.Eq{"`user`.visibility": structs.VisibleTypePublic}))))
|
||||
}
|
||||
|
||||
if opts.AllLimited {
|
||||
accessCond = accessCond.Or(builder.Eq{"is_private": false}.And(builder.In("owner_id", builder.Select("`user`.id").From("`user`").Where(builder.Eq{"`user`.visibility": structs.VisibleTypeLimited}))))
|
||||
}
|
||||
|
||||
cond = cond.And(accessCond)
|
||||
|
Reference in New Issue
Block a user