summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2016-12-12 08:58:13 +0000
committerSean McGivern <sean@mcgivern.me.uk>2016-12-12 08:58:13 +0000
commit87f3a66c32f8cab6c814f81ec9dfea69f64d79cc (patch)
tree3afd55ea01c39ab1341bf01dbadfe520618a4b6c /app/finders
parent221a461c1e917e816e30c213d48ad0ff87170527 (diff)
parentfde754e2676e40dcf2600190983ef54030c5d5a5 (diff)
downloadgitlab-ce-87f3a66c32f8cab6c814f81ec9dfea69f64d79cc.tar.gz
Merge branch 'features/api-snippets' into 'master'
Adding support for personal snippet endpoint on the API Closes #22042 See merge request !6373
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/snippets_finder.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb
index 00ff1611039..0586a923a74 100644
--- a/app/finders/snippets_finder.rb
+++ b/app/finders/snippets_finder.rb
@@ -1,12 +1,15 @@
class SnippetsFinder
def execute(current_user, params = {})
filter = params[:filter]
+ user = params.fetch(:user, current_user)
case filter
when :all then
snippets(current_user).fresh
+ when :public then
+ Snippet.are_public.fresh
when :by_user then
- by_user(current_user, params[:user], params[:scope])
+ by_user(current_user, user, params[:scope])
when :by_project
by_project(current_user, params[:project])
end