From 73481e8f45cee45ffc55c4c5fbfe0cdd3e02b5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Alves?= <18471038+italoaalves@users.noreply.github.com> Date: Fri, 17 May 2024 06:36:31 -0300 Subject: [PATCH] FIX: Add check for existing provider_uids to generic import (#26914) Co-authored-by: Gerhard Schlager --- script/bulk_import/generic_bulk.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script/bulk_import/generic_bulk.rb b/script/bulk_import/generic_bulk.rb index c5f03c6e635..3830e682fa4 100644 --- a/script/bulk_import/generic_bulk.rb +++ b/script/bulk_import/generic_bulk.rb @@ -623,10 +623,13 @@ class BulkImport::Generic < BulkImport::Base SQL existing_user_ids = UserAssociatedAccount.pluck(:user_id).to_set + existing_provider_uids = UserAssociatedAccount.pluck(:provider_uid, :provider_name).to_set create_user_associated_accounts(accounts) do |row| user_id = user_id_from_imported_id(row["user_id"]) + next if user_id && existing_user_ids.include?(user_id) + next if existing_provider_uids.include?([row["provider_uid"], row["provider_name"]]) { user_id: user_id,