parent
7fb09f035a
commit
ba91214633
4 changed files with 71 additions and 9 deletions
|
@ -620,6 +620,7 @@ type AccessibleReposEnvironment interface {
|
|||
RepoIDs(page, pageSize int) ([]int64, error)
|
||||
Repos(page, pageSize int) ([]*Repository, error)
|
||||
MirrorRepos() ([]*Repository, error)
|
||||
AddKeyword(keyword string)
|
||||
}
|
||||
|
||||
type accessibleReposEnv struct {
|
||||
|
@ -627,6 +628,7 @@ type accessibleReposEnv struct {
|
|||
userID int64
|
||||
teamIDs []int64
|
||||
e Engine
|
||||
keyword string
|
||||
}
|
||||
|
||||
// AccessibleReposEnv an AccessibleReposEnvironment for the repositories in `org`
|
||||
|
@ -656,6 +658,9 @@ func (env *accessibleReposEnv) cond() builder.Cond {
|
|||
if len(env.teamIDs) > 0 {
|
||||
cond = cond.Or(builder.In("team_repo.team_id", env.teamIDs))
|
||||
}
|
||||
if env.keyword != "" {
|
||||
cond = cond.And(builder.Like{"`repository`.lower_name", strings.ToLower(env.keyword)})
|
||||
}
|
||||
return cond
|
||||
}
|
||||
|
||||
|
@ -731,3 +736,7 @@ func (env *accessibleReposEnv) MirrorRepos() ([]*Repository, error) {
|
|||
In("`repository`.id", repoIDs).
|
||||
Find(&repos)
|
||||
}
|
||||
|
||||
func (env *accessibleReposEnv) AddKeyword(keyword string) {
|
||||
env.keyword = keyword
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue