diff --git a/app/models/user.rb b/app/models/user.rb index bf89597d19c..9a86dca053b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -778,10 +778,11 @@ class User < ActiveRecord::Base def associated_accounts result = [] - 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 << "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 << "#{oauth2_user_info.provider}(#{oauth2_user_info.email})" if oauth2_user_info user_open_ids.each do |oid| result << "OpenID #{oid.url[0..20]}...(#{oid.email})" diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 897a8e5464d..ea5d32a923c 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -323,9 +323,10 @@ describe User do FacebookUserInfo.create(user_id: user.id, username: "sam", facebook_user_id: 1) 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) user.reload - expect(user.associated_accounts).to eq("Twitter(sam), Facebook(sam), Google(sam@sam.com), Github(sam)") + expect(user.associated_accounts).to eq("Twitter(sam), Facebook(sam), Google(sam@sam.com), Github(sam), linkedin(sam@sam.com)") end end