mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Merge users based on their email in vBulletin importer
This commit is contained in:
parent
7166d7de9a
commit
637123ff6f
2 changed files with 10 additions and 22 deletions
|
@ -2,28 +2,16 @@ module ImportScripts
|
|||
class LookupContainer
|
||||
def initialize
|
||||
puts 'Loading existing groups...'
|
||||
@groups = {}
|
||||
GroupCustomField.where(name: 'import_id').pluck(:group_id, :value).each do |group_id, import_id|
|
||||
@groups[import_id] = group_id
|
||||
end
|
||||
@groups = GroupCustomField.where(name: 'import_id').pluck(:value, :group_id).to_h
|
||||
|
||||
puts 'Loading existing users...'
|
||||
@users = {}
|
||||
UserCustomField.where(name: 'import_id').pluck(:user_id, :value).each do |user_id, import_id|
|
||||
@users[import_id] = user_id
|
||||
end
|
||||
@users = UserCustomField.where(name: 'import_id').pluck(:value, :user_id).to_h
|
||||
|
||||
puts 'Loading existing categories...'
|
||||
@categories = {}
|
||||
CategoryCustomField.where(name: 'import_id').pluck(:category_id, :value).each do |category_id, import_id|
|
||||
@categories[import_id] = category_id
|
||||
end
|
||||
@categories = CategoryCustomField.where(name: 'import_id').pluck(:value, :category_id).to_h
|
||||
|
||||
puts 'Loading existing posts...'
|
||||
@posts = {}
|
||||
PostCustomField.where(name: 'import_id').pluck(:post_id, :value).each do |post_id, import_id|
|
||||
@posts[import_id] = post_id
|
||||
end
|
||||
@posts = PostCustomField.where(name: 'import_id').pluck(:value, :post_id).to_h
|
||||
|
||||
puts 'Loading existing topics...'
|
||||
@topics = {}
|
||||
|
@ -73,19 +61,19 @@ module ImportScripts
|
|||
end
|
||||
|
||||
def add_group(import_id, group)
|
||||
@groups[import_id] = group.id
|
||||
@groups[import_id.to_s] = group.id
|
||||
end
|
||||
|
||||
def add_user(import_id, user)
|
||||
@users[import_id] = user.id
|
||||
@users[import_id.to_s] = user.id
|
||||
end
|
||||
|
||||
def add_category(import_id, category)
|
||||
@categories[import_id] = category.id
|
||||
@categories[import_id.to_s] = category.id
|
||||
end
|
||||
|
||||
def add_post(import_id, post)
|
||||
@posts[import_id] = post.id
|
||||
@posts[import_id.to_s] = post.id
|
||||
end
|
||||
|
||||
def add_topic(post)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue