From 96ae0129ef4db2bb5c7fc3bdcbc128700f116ac1 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 13 Mar 2017 00:53:50 -0400 Subject: models/repo: minor code style and comment fix (#4273) --- gogs.go | 2 +- models/repo.go | 18 +++++++++--------- templates/.VERSION | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gogs.go b/gogs.go index b196f2e5..ce0d7aea 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.10.16.0312" +const APP_VER = "0.10.17.0313" func init() { setting.AppVer = APP_VER diff --git a/models/repo.go b/models/repo.go index 5cc0471c..2b9fc0d9 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1570,7 +1570,7 @@ func GetRepositoryCount(u *User) (int64, error) { type SearchRepoOptions struct { Keyword string OwnerID int64 - UserID int64 // if set results will contain all public/private repositories user has access to + UserID int64 // When set results will contain all public/private repositories user has access to OrderBy string Private bool // Include private repositories in results Page int @@ -1591,21 +1591,21 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int repos = make([]*Repository, 0, opts.PageSize) sess := x.Alias("repo") - // Attempt to find repositories that opts.UserId has access to - // This does not include other people's private repositories even if opts.UserId is an admin + // Attempt to find repositories that opts.UserID has access to, + // this does not include other people's private repositories even if opts.UserID is an admin. if !opts.Private && opts.UserID > 0 { - sess.Join("LEFT", "access", "access.repo_id = repo.id") - sess.Where("repo.lower_name LIKE ? AND (repo.owner_id=? OR access.user_id=? OR repo.is_private=?)", - "%"+opts.Keyword+"%", opts.UserID, opts.UserID, false) + sess.Join("LEFT", "access", "access.repo_id = repo.id"). + Where("repo.lower_name LIKE ? AND (repo.owner_id = ? OR access.user_id = ? OR repo.is_private = ?)", + "%"+opts.Keyword+"%", opts.UserID, opts.UserID, false) } else { sess.Where("repo.lower_name LIKE ?", "%"+opts.Keyword+"%") - // only return public repositories if opts.Private is not set + // Only return public repositories if opts.Private is not set if !opts.Private { - sess.And("repo.is_private=?", false) + sess.And("repo.is_private = ?", false) } } if opts.OwnerID > 0 { - sess.And("repo.owner_id=?", opts.OwnerID) + sess.And("repo.owner_id = ?", opts.OwnerID) } var countSess xorm.Session diff --git a/templates/.VERSION b/templates/.VERSION index 882ee5eb..5a4881ef 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.10.16.0312 \ No newline at end of file +0.10.17.0313 \ No newline at end of file -- cgit v1.2.3