aboutsummaryrefslogtreecommitdiffstats
path: root/models/org.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/org.go')
-rw-r--r--models/org.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/org.go b/models/org.go
index 3f17e3641f..daff110cf5 100644
--- a/models/org.go
+++ b/models/org.go
@@ -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
+}