summaryrefslogtreecommitdiffstats
path: root/models/org.go
diff options
context:
space:
mode:
authorRichard Mahn <richmahn@users.noreply.github.com>2019-02-08 09:45:43 -0700
committertechknowlogick <matti@mdranta.net>2019-02-08 11:45:43 -0500
commitba91214633280313a7b97205b9a7cb6e43001680 (patch)
tree2392f593b9ffb8898de0b3edd596262fb10bf427 /models/org.go
parent7fb09f035ac8b10191c154ed4395a8e02d3c5e8d (diff)
downloadgitea-ba91214633280313a7b97205b9a7cb6e43001680.tar.gz
gitea-ba91214633280313a7b97205b9a7cb6e43001680.zip
Feature - #3031 - search for org repos (#5986)
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
+}