diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-15 09:09:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-15 09:09:34 +0000 |
commit | a898b6057ecf9ab635c45217568d44eab5c32ec0 (patch) | |
tree | caf9dbacd3058a6714478ea16b9bd54b2ac463ce /app/services/snippets/base_service.rb | |
parent | 7d5d23819bd51063dc641c29bff7b334cea83d84 (diff) | |
download | gitlab-ce-a898b6057ecf9ab635c45217568d44eab5c32ec0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/snippets/base_service.rb')
-rw-r--r-- | app/services/snippets/base_service.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/services/snippets/base_service.rb b/app/services/snippets/base_service.rb index 1985ced9dd0..d9e8326f159 100644 --- a/app/services/snippets/base_service.rb +++ b/app/services/snippets/base_service.rb @@ -6,15 +6,15 @@ module Snippets CreateRepositoryError = Class.new(StandardError) - attr_reader :uploaded_assets, :snippet_files + attr_reader :uploaded_assets, :snippet_actions def initialize(project, user = nil, params = {}) super @uploaded_assets = Array(@params.delete(:files).presence) - input_actions = Array(@params.delete(:snippet_files).presence) - @snippet_files = SnippetInputActionCollection.new(input_actions, allowed_actions: restricted_files_actions) + input_actions = Array(@params.delete(:snippet_actions).presence) + @snippet_actions = SnippetInputActionCollection.new(input_actions, allowed_actions: restricted_files_actions) filter_spam_check_params end @@ -32,18 +32,18 @@ module Snippets end def valid_params? - return true if snippet_files.empty? + return true if snippet_actions.empty? - (params.keys & [:content, :file_name]).none? && snippet_files.valid? + (params.keys & [:content, :file_name]).none? && snippet_actions.valid? end def invalid_params_error(snippet) - if snippet_files.valid? + if snippet_actions.valid? [:content, :file_name].each do |key| snippet.errors.add(key, 'and snippet files cannot be used together') if params.key?(key) end else - snippet.errors.add(:snippet_files, 'have invalid data') + snippet.errors.add(:snippet_actions, 'have invalid data') end snippet_error_response(snippet, 403) @@ -75,7 +75,7 @@ module Snippets end def files_to_commit(snippet) - snippet_files.to_commit_actions.presence || build_actions_from_params(snippet) + snippet_actions.to_commit_actions.presence || build_actions_from_params(snippet) end def build_actions_from_params(snippet) |