diff options
author | zeripath <art27@cantab.net> | 2020-05-21 14:23:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-21 08:23:20 -0500 |
commit | 8525a4858107ec39a063c3d793f17b516909be15 (patch) | |
tree | a8883adde3850909a7deaeeb8905daf05e3946cc /models | |
parent | 034492384b739863363ea1651702e09ab6e2a0ed (diff) | |
download | gitea-8525a4858107ec39a063c3d793f17b516909be15.tar.gz gitea-8525a4858107ec39a063c3d793f17b516909be15.zip |
Fix repo-list private and total count bugs (#11500) (#11532)
* 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>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'models')
-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 { |