このコミットが含まれているのは:
@@ -22,6 +22,7 @@ class PostImportRunner
|
||||
raise ArgumentError, '取込項目が不正です.' unless (attributes.keys - ATTRIBUTE_KEYS).empty?
|
||||
raise ArgumentError, '取込項目が大きすぎます.' if attributes.values.any? { _1.to_s.bytesize > PostImportSourceParser::MAX_CELL_BYTES }
|
||||
raise ArgumentError, 'URL が長すぎます.' if row['url'].to_s.bytesize > PostImportSourceParser::MAX_CELL_BYTES
|
||||
validate_tag_sources!(row['tag_sources'])
|
||||
preview = PostImportPreviewer.new(parsed: { columns: [], rows: [] }, url_column: 0,
|
||||
mappings: {}, existing: @existing).preview_rows(
|
||||
rows: [{ source_row: row['source_row'], url: row['url'],
|
||||
@@ -46,4 +47,14 @@ class PostImportRunner
|
||||
Rails.logger.error("post_import_runner_failure #{ { error: e.class.name, message: e.message }.to_json }")
|
||||
{ source_row: row['source_row'], status: 'failed', errors: { base: ['登録中にエラーが発生しました.'] } }
|
||||
end
|
||||
|
||||
def validate_tag_sources! sources
|
||||
return if sources.blank?
|
||||
|
||||
sources = sources.to_h
|
||||
raise ArgumentError unless (sources.keys - %w[automatic mapped fixed manual]).empty?
|
||||
raise ArgumentError unless sources.values.all?(String)
|
||||
raise ArgumentError if sources.values.any? { _1.bytesize > PostImportSourceParser::MAX_CELL_BYTES }
|
||||
raise ArgumentError if sources.values.sum(&:bytesize) > PostImportSourceParser::MAX_CELL_BYTES
|
||||
end
|
||||
end
|
||||
|
||||
新しい課題から参照
ユーザをブロックする