diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /lib/api/project_snippets.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'lib/api/project_snippets.rb')
-rw-r--r-- | lib/api/project_snippets.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb index 09934502e85..fba4c60504f 100644 --- a/lib/api/project_snippets.rb +++ b/lib/api/project_snippets.rb @@ -56,16 +56,20 @@ module API end params do requires :title, type: String, allow_blank: false, desc: 'The title of the snippet' - requires :file_name, type: String, desc: 'The file name of the snippet' - requires :content, type: String, allow_blank: false, desc: 'The content of the snippet' optional :description, type: String, desc: 'The description of a snippet' requires :visibility, type: String, values: Gitlab::VisibilityLevel.string_values, desc: 'The visibility of the snippet' + use :create_file_params end post ":id/snippets" do authorize! :create_snippet, user_project - snippet_params = declared_params(include_missing: false).merge(request: request, api: true) + snippet_params = declared_params(include_missing: false).tap do |create_args| + create_args[:request] = request + create_args[:api] = true + + process_file_args(create_args) + end service_response = ::Snippets::CreateService.new(user_project, current_user, snippet_params).execute snippet = service_response.payload[:snippet] |