Skip to content

Commit

Permalink
FIX: Add check for existing provider_uids to generic import (#26914)
Browse files Browse the repository at this point in the history
Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
  • Loading branch information
italoaalves and gschlager committed May 17, 2024
1 parent e1f3db8 commit 73481e8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions script/bulk_import/generic_bulk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,13 @@ def import_user_associated_accounts
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,
Expand Down

0 comments on commit 73481e8

Please sign in to comment.