summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-19 18:51:38 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-19 18:51:38 +0000
commit20cc4bc47533f34b62b7c8283e8de4eee8c5b852 (patch)
tree19bf81eec96ad7e803d4927bf95686b19798e5f0 /app
parent084614dec8e135eafc8d1868ee0d2f75ab722c33 (diff)
parentae6080c791ee8b6aedd7091e2a321f5fe41f0978 (diff)
downloadgitlab-ce-20cc4bc47533f34b62b7c8283e8de4eee8c5b852.tar.gz
Merge branch 'add-public-param-to-project-api' into 'master'
Add public params to GET /projects api. Closes #3788 See merge request !2409
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index cb668e0c2f7..5579710a476 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -272,6 +272,10 @@ class Project < ActiveRecord::Base
query: "%#{query.try(:downcase)}%")
end
+ def search_by_visibility(level)
+ where(visibility_level: Gitlab::VisibilityLevel.const_get(level.upcase))
+ end
+
def search_by_title(query)
where('projects.archived = ?', false).where('LOWER(projects.name) LIKE :query', query: "%#{query.downcase}%")
end