FIX: Associated Instagram account was missing at some places
This commit is contained in:
parent
7ae1c5a663
commit
fffd1a6602
|
@ -61,6 +61,7 @@ class User < ActiveRecord::Base
|
|||
has_one :github_user_info, dependent: :destroy
|
||||
has_one :google_user_info, dependent: :destroy
|
||||
has_one :oauth2_user_info, dependent: :destroy
|
||||
has_one :instagram_user_info, dependent: :destroy
|
||||
has_one :user_second_factor, dependent: :destroy
|
||||
has_one :user_stat, dependent: :destroy
|
||||
has_one :user_profile, dependent: :destroy, inverse_of: :user
|
||||
|
@ -887,7 +888,8 @@ class User < ActiveRecord::Base
|
|||
result << "Twitter(#{twitter_user_info.screen_name})" if twitter_user_info
|
||||
result << "Facebook(#{facebook_user_info.username})" if facebook_user_info
|
||||
result << "Google(#{google_user_info.email})" if google_user_info
|
||||
result << "Github(#{github_user_info.screen_name})" if github_user_info
|
||||
result << "GitHub(#{github_user_info.screen_name})" if github_user_info
|
||||
result << "Instagram(#{instagram_user_info.screen_name})" if instagram_user_info
|
||||
result << "#{oauth2_user_info.provider}(#{oauth2_user_info.email})" if oauth2_user_info
|
||||
|
||||
user_open_ids.each do |oid|
|
||||
|
|
|
@ -45,6 +45,7 @@ class UserAnonymizer
|
|||
@user.facebook_user_info.try(:destroy)
|
||||
@user.single_sign_on_record.try(:destroy)
|
||||
@user.oauth2_user_info.try(:destroy)
|
||||
@user.instagram_user_info.try(:destroy)
|
||||
@user.user_open_ids.find_each { |x| x.destroy }
|
||||
@user.api_key.try(:destroy)
|
||||
|
||||
|
|
|
@ -384,9 +384,10 @@ describe User do
|
|||
GoogleUserInfo.create(user_id: user.id, email: "sam@sam.com", google_user_id: 1)
|
||||
GithubUserInfo.create(user_id: user.id, screen_name: "sam", github_user_id: 1)
|
||||
Oauth2UserInfo.create(user_id: user.id, provider: "linkedin", email: "sam@sam.com", uid: 1)
|
||||
InstagramUserInfo.create(user_id: user.id, screen_name: "sam", instagram_user_id: "examplel123123")
|
||||
|
||||
user.reload
|
||||
expect(user.associated_accounts).to eq("Twitter(sam), Facebook(sam), Google(sam@sam.com), Github(sam), linkedin(sam@sam.com)")
|
||||
expect(user.associated_accounts).to eq("Twitter(sam), Facebook(sam), Google(sam@sam.com), GitHub(sam), Instagram(sam), linkedin(sam@sam.com)")
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -112,6 +112,7 @@ describe UserAnonymizer do
|
|||
user.facebook_user_info = FacebookUserInfo.create(user_id: user.id, facebook_user_id: "example")
|
||||
user.single_sign_on_record = SingleSignOnRecord.create(user_id: user.id, external_id: "example", last_payload: "looks good")
|
||||
user.oauth2_user_info = Oauth2UserInfo.create(user_id: user.id, uid: "example", provider: "example")
|
||||
user.instagram_user_info = InstagramUserInfo.create(user_id: user.id, screen_name: "example", instagram_user_id: "examplel123123")
|
||||
UserOpenId.create(user_id: user.id, email: user.email, url: "http://example.com/openid", active: true)
|
||||
make_anonymous
|
||||
user.reload
|
||||
|
@ -121,6 +122,7 @@ describe UserAnonymizer do
|
|||
expect(user.facebook_user_info).to eq(nil)
|
||||
expect(user.single_sign_on_record).to eq(nil)
|
||||
expect(user.oauth2_user_info).to eq(nil)
|
||||
expect(user.instagram_user_info).to eq(nil)
|
||||
expect(user.user_open_ids.count).to eq(0)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue