Commit 0b5fa2d4 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Fix kwargs deprecation warnings for Ruby 2.7

Fixes several deprecation warnings
parent 37bc6d03
......@@ -40,13 +40,12 @@ module Issuable
csv_data = @csv_io.open(&:read).force_encoding(Encoding::UTF_8)
validate_headers_presence!(csv_data.lines.first)
csv_parsing_params = {
CSV.new(
csv_data,
col_sep: detect_col_sep(csv_data.lines.first),
headers: true,
header_converters: :symbol
}
CSV.new(csv_data, csv_parsing_params).each.with_index(2)
).each.with_index(2)
end
def validate_headers_presence!(headers)
......
......@@ -67,7 +67,7 @@ module Notes
track_event(note, current_user)
if Feature.enabled?(:notes_create_service_tracking, project)
Gitlab::Tracking.event('Notes::CreateService', 'execute', tracking_data_for(note))
Gitlab::Tracking.event('Notes::CreateService', 'execute', **tracking_data_for(note))
end
if note.for_merge_request? && note.diff_note? && note.start_of_discussion?
......
......@@ -6,16 +6,18 @@ class UploadService
end
def execute
return unless @file && @file.size <= max_attachment_size
return unless file && file.size <= max_attachment_size
uploader = @uploader_class.new(@model, nil, @uploader_context)
uploader.store!(@file)
uploader = uploader_class.new(model, nil, **uploader_context)
uploader.store!(file)
uploader
end
private
attr_reader :model, :file, :uploader_class, :uploader_context
def max_attachment_size
Gitlab::CurrentSettings.max_attachment_size.megabytes.to_i
end
......
......@@ -26,7 +26,7 @@
- if issue.service_desk_reply_to
#{issue.service_desk_reply_to} via
#{link_to_member(@project, issue.author, avatar: false)}
= render_if_exists 'shared/issuable/gitlab_team_member_badge', {author: issue.author}
= render_if_exists 'shared/issuable/gitlab_team_member_badge', author: issue.author
- if issue.milestone
%span.issuable-milestone.d-none.d-sm-inline-block
&nbsp;
......
......@@ -20,7 +20,7 @@
&middot;
opened #{time_ago_with_tooltip(merge_request.created_at, placement: 'bottom')}
by #{link_to_member(@project, merge_request.author, avatar: false)}
= render_if_exists 'shared/issuable/gitlab_team_member_badge', {author: merge_request.author}
= render_if_exists 'shared/issuable/gitlab_team_member_badge', author: merge_request.author
- if merge_request.milestone
%span.issuable-milestone.d-none.d-sm-inline-block
&nbsp;
......
......@@ -58,7 +58,7 @@
= f.hidden_field 'milestone_id', value: milestone[:id], id: nil
= dropdown_tag('Milestone', options: { title: _('Assign milestone'), toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: _('Search milestones'), data: { show_no: true, field_name: "#{issuable_type}[milestone_id]", project_id: issuable_sidebar[:project_id], issuable_id: issuable_sidebar[:id], ability_name: issuable_type, issue_update: issuable_sidebar[:issuable_json_path], use_id: true, default_no: true, selected: milestone[:title], null_default: true, display: 'static' }})
- if @project.group.present?
= render_if_exists 'shared/issuable/iteration_select', { can_edit: can_edit_issuable, group_path: @project.group.full_path, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid], issuable_type: issuable_type }
= render_if_exists 'shared/issuable/iteration_select', can_edit: can_edit_issuable, group_path: @project.group.full_path, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid], issuable_type: issuable_type
- if issuable_sidebar[:supports_time_tracking]
#issuable-time-tracker.block
......
......@@ -5,7 +5,7 @@ module WorkerContext
class_methods do
def worker_context(attributes)
@worker_context = Gitlab::ApplicationContext.new(attributes)
@worker_context = Gitlab::ApplicationContext.new(**attributes)
end
def get_worker_context
......@@ -60,6 +60,6 @@ module WorkerContext
end
def with_context(context, &block)
Gitlab::ApplicationContext.new(context).use { yield(**context) }
Gitlab::ApplicationContext.new(**context).use { yield(**context) }
end
end
......@@ -23,7 +23,7 @@ module Gitlab
def context_by_arguments
@context_by_arguments ||= objects.each_with_object({}) do |object, result|
arguments = Array.wrap(arguments_proc.call(object))
context = Gitlab::ApplicationContext.new(context_proc.call(object))
context = Gitlab::ApplicationContext.new(**context_proc.call(object))
result[arguments] = context
end
......
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