diff options
author | zeripath <art27@cantab.net> | 2020-05-21 02:15:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 22:15:30 -0300 |
commit | 3eb323901c6ec791294db492783e202558c2824f (patch) | |
tree | 0422f11c5089213dfb165deb24f9861353599c80 /models/repo_list.go | |
parent | b797b76abd13beba348415bdb81c7d3593bb01f9 (diff) | |
download | gitea-3eb323901c6ec791294db492783e202558c2824f.tar.gz gitea-3eb323901c6ec791294db492783e202558c2824f.zip |
Fix repo-list private and total count bugs (#11500)
* Fix repo-list private and total count bugs
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Ensure limited and private org public repos are displayed on "private"
Signed-off-by: Andrew Thornton <art27@cantab.net>
* switch from onlyPrivate to is_private
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Generate swagger
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'models/repo_list.go')
-rw-r--r-- | models/repo_list.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/models/repo_list.go b/models/repo_list.go index 3e580a7229..dea88d8816 100644 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -140,10 +140,13 @@ type SearchRepoOptions struct { PriorityOwnerID int64 OrderBy SearchOrderBy Private bool // Include private repositories in results - OnlyPrivate bool // Include only private repositories in results StarredByID int64 AllPublic bool // Include also all public repositories of users and public organisations AllLimited bool // Include also all public repositories of limited organisations + // None -> include public and private + // True -> include just private + // False -> incude just public + IsPrivate util.OptionalBool // None -> include collaborative AND non-collaborative // True -> include just collaborative // False -> incude just non-collaborative @@ -221,15 +224,8 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond { )))) } - if opts.OnlyPrivate { - cond = cond.And( - builder.Or( - builder.Eq{"is_private": true}, - builder.In("owner_id", builder.Select("id").From("`user`").Where( - builder.And( - builder.Eq{"type": UserTypeOrganization}, - builder.Or(builder.Eq{"visibility": structs.VisibleTypeLimited}, builder.Eq{"visibility": structs.VisibleTypePrivate}), - ))))) + if opts.IsPrivate != util.OptionalBoolNone { + cond = cond.And(builder.Eq{"is_private": opts.IsPrivate.IsTrue()}) } if opts.Template != util.OptionalBoolNone { |