FIX: Add check for existing provider_uids to generic import (#26914)
Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
This commit is contained in:
parent
e1f3db8861
commit
73481e8f45
|
@ -623,10 +623,13 @@ class BulkImport::Generic < BulkImport::Base
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
existing_user_ids = UserAssociatedAccount.pluck(:user_id).to_set
|
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|
|
create_user_associated_accounts(accounts) do |row|
|
||||||
user_id = user_id_from_imported_id(row["user_id"])
|
user_id = user_id_from_imported_id(row["user_id"])
|
||||||
|
|
||||||
next if user_id && existing_user_ids.include?(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,
|
user_id: user_id,
|
||||||
|
|
Loading…
Reference in New Issue