mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 22:36:43 +08:00
FIX: Display generic descriptor for associated account with no info
This commit is contained in:
parent
f6ced0a78a
commit
5e61893cb2
@ -786,6 +786,7 @@ en:
|
||||
|
||||
associated_accounts:
|
||||
revoke_failed: "Failed to revoke your account with %{provider_name}."
|
||||
connected: "(connected)"
|
||||
|
||||
activation:
|
||||
action: "Click here to activate your account"
|
||||
|
@ -4,7 +4,7 @@ class Auth::ManagedAuthenticator < Auth::Authenticator
|
||||
def description_for_user(user)
|
||||
info = UserAssociatedAccount.find_by(provider_name: name, user_id: user.id)&.info
|
||||
return "" if info.nil?
|
||||
info["email"] || info["nickname"] || info["name"] || ""
|
||||
info["email"] || info["nickname"] || info["name"] || I18n.t("associated_accounts.connected")
|
||||
end
|
||||
|
||||
# These three methods are designed to be overriden by child classes
|
||||
|
@ -261,6 +261,8 @@ describe Auth::ManagedAuthenticator do
|
||||
expect(authenticator.description_for_user(user)).to eq('somenickname')
|
||||
association.update(info: { nickname: "bestname" })
|
||||
expect(authenticator.description_for_user(user)).to eq('bestname')
|
||||
association.update(info: {})
|
||||
expect(authenticator.description_for_user(user)).to eq(I18n.t("associated_accounts.connected"))
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user