From cba292cb5624a1e901c671b00d4b6723c62c6cb9 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 12 Jul 2018 17:41:16 -0400 Subject: [PATCH 1/2] FIX: personal messages not being copied by discourse_merger.rb --- script/bulk_import/discourse_merger.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/bulk_import/discourse_merger.rb b/script/bulk_import/discourse_merger.rb index 9de5cd879aa..5f18029b833 100644 --- a/script/bulk_import/discourse_merger.rb +++ b/script/bulk_import/discourse_merger.rb @@ -435,7 +435,7 @@ class BulkImport::DiscourseMerger < BulkImport::Base end def process_topic(topic) - return nil if topic['category_id'].nil? + return nil if topic['category_id'].nil? && topic['archetype'] != Archetype.private_message topic end From 71814009bd222089c08993ac0fc5145640a89786 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 12 Jul 2018 17:43:21 -0400 Subject: [PATCH 2/2] FIX: badges for merged users don't get merged by discourse_merger.rb --- script/bulk_import/discourse_merger.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/bulk_import/discourse_merger.rb b/script/bulk_import/discourse_merger.rb index 5f18029b833..f73dfab5781 100644 --- a/script/bulk_import/discourse_merger.rb +++ b/script/bulk_import/discourse_merger.rb @@ -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