mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
FIX: discourse_merger: skip collisions on join models when both objects were merged
This commit is contained in:
parent
1ca999fdb5
commit
f7f24a5399
@ -271,7 +271,7 @@ class BulkImport::DiscourseMerger < BulkImport::Base
|
||||
@sequences[Tag.sequence_name] = last_id + 1
|
||||
|
||||
[TagUser, TopicTag, CategoryTag, CategoryTagStat].each do |k|
|
||||
copy_model(k, skip_processing: true)
|
||||
copy_model(k)
|
||||
end
|
||||
copy_model(TagGroup, mapping: @tag_groups)
|
||||
[TagGroupMembership, CategoryTagGroup].each do |k|
|
||||
@ -655,6 +655,26 @@ class BulkImport::DiscourseMerger < BulkImport::Base
|
||||
ecr
|
||||
end
|
||||
|
||||
def process_tag_user(x)
|
||||
return nil if TagUser.where(tag_id: x['tag_id'], user_id: x['user_id']).exists?
|
||||
x
|
||||
end
|
||||
|
||||
def process_topic_tag(x)
|
||||
return nil if TopicTag.where(topic_id: x['topic_id'], tag_id: x['tag_id']).exists?
|
||||
x
|
||||
end
|
||||
|
||||
def process_category_tag(x)
|
||||
return nil if CategoryTag.where(category_id: x['category_id'], tag_id: x['tag_id']).exists?
|
||||
x
|
||||
end
|
||||
|
||||
def process_category_tag_stat(x)
|
||||
return nil if CategoryTagStat.where(category_id: x['category_id'], tag_id: x['tag_id']).exists?
|
||||
x
|
||||
end
|
||||
|
||||
def user_id_from_imported_id(id)
|
||||
return id if id.to_i < 1
|
||||
super(id)
|
||||
|
Loading…
Reference in New Issue
Block a user