diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/graphql/mutations/snippets/create.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/graphql/mutations/snippets/create.rb')
-rw-r--r-- | app/graphql/mutations/snippets/create.rb | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/app/graphql/mutations/snippets/create.rb b/app/graphql/mutations/snippets/create.rb index a8aeb15afcd..37c0f80310c 100644 --- a/app/graphql/mutations/snippets/create.rb +++ b/app/graphql/mutations/snippets/create.rb @@ -3,6 +3,7 @@ module Mutations module Snippets class Create < BaseMutation + include SpammableMutationFields include ResolvesProject graphql_name 'CreateSnippet' @@ -56,10 +57,12 @@ module Mutations ::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user) end - { - snippet: service_response.success? ? snippet : nil, - errors: errors_on_object(snippet) - } + with_spam_fields(snippet) do + { + snippet: service_response.success? ? snippet : nil, + errors: errors_on_object(snippet) + } + end end private @@ -81,14 +84,16 @@ module Mutations end def create_params(args) - args.tap do |create_args| - # We need to rename `blob_actions` into `snippet_actions` because - # it's the expected key param - create_args[:snippet_actions] = create_args.delete(:blob_actions)&.map(&:to_h) - - # We need to rename `uploaded_files` into `files` because - # it's the expected key param - create_args[:files] = create_args.delete(:uploaded_files) + with_spam_params do + args.tap do |create_args| + # We need to rename `blob_actions` into `snippet_actions` because + # it's the expected key param + create_args[:snippet_actions] = create_args.delete(:blob_actions)&.map(&:to_h) + + # We need to rename `uploaded_files` into `files` because + # it's the expected key param + create_args[:files] = create_args.delete(:uploaded_files) + end end end end |