Merge pull request #2497 from BenLubar/benlubar-import-id-on-imported-posts
set import_id on imported posts
This commit is contained in:
commit
4e1f76d3b9
|
@ -242,7 +242,7 @@ class ImportScripts::Base
|
|||
skipped += 1 # already imported this post
|
||||
else
|
||||
begin
|
||||
new_post = create_post(params)
|
||||
new_post = create_post(params, import_id)
|
||||
@posts[import_id] = new_post.id
|
||||
@topic_lookup[new_post.id] = {post_number: new_post.post_number, topic_id: new_post.topic_id}
|
||||
|
||||
|
@ -263,9 +263,11 @@ class ImportScripts::Base
|
|||
return [created, skipped]
|
||||
end
|
||||
|
||||
def create_post(opts)
|
||||
def create_post(opts, import_id)
|
||||
user = User.find(opts[:user_id])
|
||||
opts = opts.merge(skip_validations: true)
|
||||
opts[:custom_fields] ||= {}
|
||||
opts[:custom_fields]['import_id'] = import_id
|
||||
|
||||
if @bbcode_to_md
|
||||
opts[:raw] = opts[:raw].bbcode_to_md rescue opts[:raw]
|
||||
|
|
Loading…
Reference in New Issue