From cf76e56b50aa714f009b0b26ab5a07ef9bba5e67 Mon Sep 17 00:00:00 2001 From: cocococosti Date: Wed, 14 Aug 2024 02:20:35 -0400 Subject: [PATCH] Adding trust levels to user import. Adding existing groups. --- script/bulk_import/generic_bulk.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/script/bulk_import/generic_bulk.rb b/script/bulk_import/generic_bulk.rb index 3b2a29a5c18..61909a91e99 100644 --- a/script/bulk_import/generic_bulk.rb +++ b/script/bulk_import/generic_bulk.rb @@ -404,8 +404,15 @@ class BulkImport::Generic < BulkImport::Base create_group_users(group_members) do |row| group_id = - row["existing_id"].nil? ? group_id_from_imported_id(row["group_id"]) : row["existing_id"] + ( + if row["existing_id"].nil? + group_id_from_imported_id(row["group_id"]) + else + row["existing_id"].to_i + end + ) user_id = user_id_from_imported_id(row["user_id"]) + next if user_id.nil? next if existing_group_user_ids.include?([group_id, user_id]) { group_id: group_id, user_id: user_id } @@ -457,6 +464,7 @@ class BulkImport::Generic < BulkImport::Base suspended_till: suspended_till, registration_ip_address: row["registration_ip_address"], date_of_birth: to_date(row["date_of_birth"]), + trust_level: row["trust_level"], } end