Commit 24c1d072 authored by charlie ablett's avatar charlie ablett

Merge branch '257438-fj-fix-some-snippet-ruby-deprecations' into 'master'

Fix Ruby 2.7 deprecation warnings in several snippet classes

See merge request gitlab-org/gitlab!43520
parents 202c6aa0 e4dad247
...@@ -8,7 +8,11 @@ class SnippetInputActionCollection ...@@ -8,7 +8,11 @@ class SnippetInputActionCollection
delegate :empty?, :any?, :[], to: :actions delegate :empty?, :any?, :[], to: :actions
def initialize(actions = [], allowed_actions: nil) def initialize(actions = [], allowed_actions: nil)
@actions = actions.map { |action| SnippetInputAction.new(action.merge(allowed_actions: allowed_actions)) } @actions = actions.map do |action|
params = action.merge(allowed_actions: allowed_actions)
SnippetInputAction.new(**params)
end
end end
def to_commit_actions def to_commit_actions
......
...@@ -83,7 +83,7 @@ module Snippets ...@@ -83,7 +83,7 @@ module Snippets
def create_commit def create_commit
attrs = commit_attrs(@snippet, INITIAL_COMMIT_MSG) attrs = commit_attrs(@snippet, INITIAL_COMMIT_MSG)
@snippet.snippet_repository.multi_files_action(current_user, files_to_commit(@snippet), attrs) @snippet.snippet_repository.multi_files_action(current_user, files_to_commit(@snippet), **attrs)
end end
def move_temporary_files def move_temporary_files
......
...@@ -100,7 +100,7 @@ module Snippets ...@@ -100,7 +100,7 @@ module Snippets
attrs = commit_attrs(snippet, INITIAL_COMMIT_MSG) attrs = commit_attrs(snippet, INITIAL_COMMIT_MSG)
actions = [{ file_path: snippet.file_name, content: snippet.content }] actions = [{ file_path: snippet.file_name, content: snippet.content }]
snippet.snippet_repository.multi_files_action(current_user, actions, attrs) snippet.snippet_repository.multi_files_action(current_user, actions, **attrs)
end end
def create_commit(snippet) def create_commit(snippet)
...@@ -108,7 +108,7 @@ module Snippets ...@@ -108,7 +108,7 @@ module Snippets
attrs = commit_attrs(snippet, UPDATE_COMMIT_MSG) attrs = commit_attrs(snippet, UPDATE_COMMIT_MSG)
snippet.snippet_repository.multi_files_action(current_user, files_to_commit(snippet), attrs) snippet.snippet_repository.multi_files_action(current_user, files_to_commit(snippet), **attrs)
end end
# Because we are removing repositories we don't want to remove # Because we are removing repositories we don't want to remove
......
...@@ -109,7 +109,7 @@ module Gitlab ...@@ -109,7 +109,7 @@ module Gitlab
end end
def create_commit(snippet) def create_commit(snippet)
snippet.snippet_repository.multi_files_action(commit_author(snippet), snippet_action(snippet), commit_attrs) snippet.snippet_repository.multi_files_action(commit_author(snippet), snippet_action(snippet), **commit_attrs)
end end
# If the user is not allowed to access git or update the snippet # If the user is not allowed to access git or update the snippet
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment