summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/snippets/update.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/snippets/update.rb')
-rw-r--r--app/graphql/mutations/snippets/update.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/app/graphql/mutations/snippets/update.rb b/app/graphql/mutations/snippets/update.rb
index d0db5fa2eb9..74266880806 100644
--- a/app/graphql/mutations/snippets/update.rb
+++ b/app/graphql/mutations/snippets/update.rb
@@ -3,6 +3,8 @@
module Mutations
module Snippets
class Update < Base
+ include SpammableMutationFields
+
graphql_name 'UpdateSnippet'
argument :id,
@@ -39,10 +41,12 @@ module Mutations
::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user)
end
- {
- snippet: result.success? ? snippet : snippet.reset,
- errors: errors_on_object(snippet)
- }
+ with_spam_fields(snippet) do
+ {
+ snippet: result.success? ? snippet : snippet.reset,
+ errors: errors_on_object(snippet)
+ }
+ end
end
private
@@ -52,10 +56,12 @@ module Mutations
end
def update_params(args)
- args.tap do |update_args|
- # We need to rename `blob_actions` into `snippet_actions` because
- # it's the expected key param
- update_args[:snippet_actions] = update_args.delete(:blob_actions)&.map(&:to_h)
+ with_spam_params do
+ args.tap do |update_args|
+ # We need to rename `blob_actions` into `snippet_actions` because
+ # it's the expected key param
+ update_args[:snippet_actions] = update_args.delete(:blob_actions)&.map(&:to_h)
+ end
end
end
end