FIX: badges for merged users don't get merged by discourse_merger.rb

This commit is contained in:
Neil Lalonde 2018-07-12 17:43:21 -04:00
parent cba292cb56
commit 71814009bd
1 changed files with 2 additions and 1 deletions

View File

@ -349,7 +349,7 @@ class BulkImport::DiscourseMerger < BulkImport::Base
@sequences[Badge.sequence_name] = last_id + 1
copy_model(UserBadge, is_a_user_model: true, skip_if_merged: true)
copy_model(UserBadge, is_a_user_model: true)
end
def copy_model(klass, skip_if_merged: false, is_a_user_model: false, skip_processing: false, mapping: nil, select_sql: nil)
@ -590,6 +590,7 @@ class BulkImport::DiscourseMerger < BulkImport::Base
def process_user_badge(user_badge)
user_badge['granted_by_id'] = user_id_from_imported_id(user_badge['granted_by_id']) if user_badge['granted_by_id']
user_badge['notification_id'] = notification_id_from_imported_id(user_badge['notification_id']) if user_badge['notification_id']
return nil if UserBadge.where(user_id: user_badge['user_id'], badge_id: user_badge['badge_id']).exists?
user_badge
end