このコミットが含まれているのは:
2026-07-14 19:12:23 +09:00
コミット 6d037192c4
9個のファイルの変更108行の追加72行の削除
+23 -21
ファイルの表示
@@ -54,20 +54,25 @@ class PostImportPreviewer
add_field_warning!(field_warnings, 'url', EXISTING_SKIP_WARNING)
attributes['tags'] = merged_tags(tag_sources, provenance['tags'])
warnings_present = field_warnings.values.any?(&:present?) || base_warnings.present?
return {
source_row: row[:source_row],
url: normal_url,
attributes:,
provenance:,
tag_sources:,
metadata_url: url_for_metadata,
skip_reason: 'existing',
existing_post_id: existing_post.id,
field_warnings:,
base_warnings:,
validation_errors:,
status: validation_errors.present? ? 'error' : (warnings_present ? 'warning' : 'ready'),
}
return { source_row: row[:source_row],
url: normal_url,
attributes:,
provenance:,
tag_sources:,
metadata_url: url_for_metadata,
skip_reason: 'existing',
existing_post_id: existing_post.id,
field_warnings:,
base_warnings:,
validation_errors:,
status:
if validation_errors.present?
'error'
elsif warnings_present
'warning'
else
'ready'
end }
end
should_fetch = should_fetch_metadata?(fetch_metadata, row[:source_row].to_i)
@@ -88,8 +93,7 @@ class PostImportPreviewer
attributes['tags'] = merged_tags(tag_sources, provenance['tags'])
warnings_present = field_warnings.values.any?(&:present?) || base_warnings.present?
{
source_row: row[:source_row],
{ source_row: row[:source_row],
url: normal_url || url,
attributes:,
provenance:,
@@ -100,8 +104,7 @@ class PostImportPreviewer
field_warnings:,
base_warnings:,
validation_errors:,
status: validation_errors.present? ? 'error' : (warnings_present ? 'warning' : 'ready'),
}
status: validation_errors.present? ? 'error' : (warnings_present ? 'warning' : 'ready') }
end
def should_fetch_metadata? fetch_metadata, source_row
@@ -175,9 +178,8 @@ class PostImportPreviewer
Preview::HttpFetcher::FetchFailed,
Preview::HttpFetcher::ResponseTooLarge => e
Rails.logger.info(
"post_import_metadata_fetch_failure "\
"#{ { error: e.class.name, message: e.message }.to_json }",
)
"post_import_metadata_fetch_failure "\
"#{ { error: e.class.name, message: e.message }.to_json }")
{ data: { }, warnings: { 'url' => [METADATA_FETCH_WARNING] } }
end