diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-17 15:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-17 15:08:42 +0300 |
commit | a89912871cb169249d3ddc2ed59326d47ecdae82 (patch) | |
tree | d8cce48535751ebfb0cb227897e0c3a1ad1d5a02 /app/graphql | |
parent | 645d157de1e637341c6be12316230397484fe7f9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql')
-rw-r--r-- | app/graphql/mutations/snippets/update.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/graphql/mutations/snippets/update.rb b/app/graphql/mutations/snippets/update.rb index b6bdcb9b67b..f0a22ebaa9d 100644 --- a/app/graphql/mutations/snippets/update.rb +++ b/app/graphql/mutations/snippets/update.rb @@ -30,12 +30,16 @@ module Mutations description: 'The visibility level of the snippet', required: false + argument :files, [Types::Snippets::FileInputType], + description: 'The snippet files to update', + required: false + def resolve(args) snippet = authorized_find!(id: args.delete(:id)) result = ::Snippets::UpdateService.new(snippet.project, - context[:current_user], - args).execute(snippet) + context[:current_user], + update_params(args)).execute(snippet) snippet = result.payload[:snippet] { @@ -47,7 +51,15 @@ module Mutations private def ability_name - "update" + 'update' + end + + def update_params(args) + args.tap do |update_args| + # We need to rename `files` into `snippet_files` because + # it's the expected key param + update_args[:snippet_files] = update_args.delete(:files)&.map(&:to_h) + end end end end |