diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-31 15:10:41 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-31 15:10:41 +0000 |
commit | 2368893df711f330cd210005e616fc3b6003ff31 (patch) | |
tree | d48874fb1279741f8e97a7f397e46d14ac2df05f /app/graphql/mutations | |
parent | 729eabcb410add9dbcfa46677308003dc95a64d0 (diff) | |
download | gitlab-ce-2368893df711f330cd210005e616fc3b6003ff31.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/mutations')
-rw-r--r-- | app/graphql/mutations/snippets/create.rb | 5 | ||||
-rw-r--r-- | app/graphql/mutations/snippets/update.rb | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/app/graphql/mutations/snippets/create.rb b/app/graphql/mutations/snippets/create.rb index 37a281871c2..a8aeb15afcd 100644 --- a/app/graphql/mutations/snippets/create.rb +++ b/app/graphql/mutations/snippets/create.rb @@ -51,6 +51,11 @@ module Mutations snippet = service_response.payload[:snippet] + # Only when the user is not an api user and the operation was successful + if !api_user? && service_response.success? + ::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user) + end + { snippet: service_response.success? ? snippet : nil, errors: errors_on_object(snippet) diff --git a/app/graphql/mutations/snippets/update.rb b/app/graphql/mutations/snippets/update.rb index fee2f61e927..d0db5fa2eb9 100644 --- a/app/graphql/mutations/snippets/update.rb +++ b/app/graphql/mutations/snippets/update.rb @@ -34,6 +34,11 @@ module Mutations update_params(args)).execute(snippet) snippet = result.payload[:snippet] + # Only when the user is not an api user and the operation was successful + if !api_user? && result.success? + ::Gitlab::UsageDataCounters::EditorUniqueCounter.track_snippet_editor_edit_action(author: current_user) + end + { snippet: result.success? ? snippet : snippet.reset, errors: errors_on_object(snippet) |