diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-04 06:10:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-04 06:10:53 +0300 |
commit | 982880576eb35b48caf6791687d4f023136cca25 (patch) | |
tree | 0d7df1f676a920a15250f5789c60111d21681cde /app/services/issuable | |
parent | ff71e5f91c447686ab7bec7407dba0d4738a8807 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/issuable')
-rw-r--r-- | app/services/issuable/import_csv/base_service.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/services/issuable/import_csv/base_service.rb b/app/services/issuable/import_csv/base_service.rb index 6ab8ec79f41..1a05073554e 100644 --- a/app/services/issuable/import_csv/base_service.rb +++ b/app/services/issuable/import_csv/base_service.rb @@ -21,13 +21,9 @@ module Issuable def process_csv with_csv_lines.each do |row, line_no| - issuable_attributes = { - title: row[:title], - description: row[:description], - due_date: row[:due_date] - } + attributes = issuable_attributes_for(row) - if create_issuable(issuable_attributes).persisted? + if create_issuable(attributes).persisted? @results[:success] += 1 else @results[:error_lines].push(line_no) @@ -37,6 +33,14 @@ module Issuable @results[:parse_error] = true end + def issuable_attributes_for(row) + { + title: row[:title], + description: row[:description], + due_date: row[:due_date] + } + end + def with_csv_lines csv_data = @csv_io.open(&:read).force_encoding(Encoding::UTF_8) validate_headers_presence!(csv_data.lines.first) |