diff options
author | Guyzmo <guyzmo+gitlab+pub@m0g.net> | 2016-11-26 18:37:26 +0300 |
---|---|---|
committer | Guyzmo <guyzmo+gitlab+pub@m0g.net> | 2016-12-01 21:07:49 +0300 |
commit | fde754e2676e40dcf2600190983ef54030c5d5a5 (patch) | |
tree | d8d68db59c5625369242c394eb6fa788185a0f17 /app/finders | |
parent | cf1a31a3459786f637971e2dafe4df31f5a28e74 (diff) |
API: Endpoint to expose personal snippets as /snippets
Adding the necessary API for the new /snippets Restful resource
added with this commit. Added a new Grape class `Snippets`, as
well as a `PersonalSnippet` entity.
Issue: #20042
Merge-Request: !6373
Signed-off-by: Guyzmo <guyzmo+gitlab+pub@m0g.net>
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/snippets_finder.rb | 5 |
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 |