mirror of
https://github.com/gogs/gogs.git
synced 2025-09-04 19:37:58 +00:00
models/repo: minor code style and comment fix (#4273)
This commit is contained in:
parent
aaadc61ee8
commit
96ae0129ef
2
gogs.go
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
|
||||
|
@ -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
|
||||
|
@ -1 +1 @@
|
||||
0.10.16.0312
|
||||
0.10.17.0313
|
Loading…
x
Reference in New Issue
Block a user