Browse Source

models/repo: minor code style and comment fix (#4273)

pull/3422/merge
Unknwon 8 years ago
parent
commit
96ae0129ef
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      gogs.go
  2. 18
      models/repo.go
  3. 2
      templates/.VERSION

2
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

18
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

2
templates/.VERSION

@ -1 +1 @@
0.10.16.0312
0.10.17.0313
Loading…
Cancel
Save