FIX: Allow merging users when email domains are restricted

This commit is contained in:
David Taylor
2020-06-09 18:51:59 +01:00
parent a3cf1cf6ff
commit ae6c4cd237
3 changed files with 12 additions and 1 deletions

View File

@@ -990,6 +990,15 @@ describe UserMerger do
expect(User.find_by_username(source_user.username)).to be_nil
end
it "works even when email domains are restricted" do
SiteSetting.email_domains_whitelist = "example.com|work.com"
source_user.update_attribute(:admin, true)
expect(User.find_by_username(source_user.username)).to be_present
merge_users!
expect(User.find_by_username(source_user.username)).to be_nil
end
it "deletes external auth infos of source user" do
UserAssociatedAccount.create(user_id: source_user.id, provider_name: "facebook", provider_uid: "1234")
GithubUserInfo.create(user_id: source_user.id, screen_name: "example", github_user_id: "examplel123123")