2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FIX: Merging users shouldn't add more than 1 secondary email

This commit is contained in:
Gerhard Schlager 2018-03-01 17:50:13 +01:00
parent a7c50039de
commit 79590e4bec
2 changed files with 17 additions and 3 deletions

View file

@ -371,7 +371,7 @@ class UserMerger
update_user_id(:user_custom_fields, conditions: "x.name = y.name")
update_user_id(:user_emails, conditions: "x.email = y.email", updates: '"primary" = false')
update_user_id(:user_emails, conditions: "x.email = y.email OR y.primary = false", updates: '"primary" = false')
UserExport.where(user_id: @source_user.id).update_all(user_id: @target_user.id)
@ -405,6 +405,7 @@ class UserMerger
def update_user_id(table_name, opts = {})
builder = update_user_id_sql_builder(table_name, opts)
puts builder.to_sql
builder.exec(source_user_id: @source_user.id, target_user_id: @target_user.id)
end