このコミットが含まれているのは:
@@ -46,6 +46,13 @@ class PostImportRunner
|
||||
end
|
||||
|
||||
{ source_row: row['source_row'], status: 'failed', errors: e.record.errors.to_hash }
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
existing_post = existing_post_for_race(row)
|
||||
raise unless existing_post
|
||||
|
||||
{ source_row: row['source_row'],
|
||||
status: 'skipped',
|
||||
existing_post_id: existing_post.id }
|
||||
rescue Tag::NicoTagNormalisationError
|
||||
{ source_row: row['source_row'],
|
||||
status: 'failed',
|
||||
@@ -66,8 +73,10 @@ class PostImportRunner
|
||||
errors: { base: ['登録中にエラーが発生しました.'] } }
|
||||
end
|
||||
|
||||
def existing_post_for_race row, record
|
||||
return nil unless record.errors.of_kind?(:url, :taken)
|
||||
def existing_post_for_race row, record = nil
|
||||
if record && !(record.errors.of_kind?(:url, :taken))
|
||||
return nil
|
||||
end
|
||||
|
||||
normal_url = PostUrlNormaliser.normalise(row['url'])
|
||||
return nil if normal_url.blank?
|
||||
|
||||
新しい課題から参照
ユーザをブロックする