mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 06:46:39 +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:
|
associated_accounts:
|
||||||
revoke_failed: "Failed to revoke your account with %{provider_name}."
|
revoke_failed: "Failed to revoke your account with %{provider_name}."
|
||||||
|
connected: "(connected)"
|
||||||
|
|
||||||
activation:
|
activation:
|
||||||
action: "Click here to activate your account"
|
action: "Click here to activate your account"
|
||||||
|
@ -4,7 +4,7 @@ class Auth::ManagedAuthenticator < Auth::Authenticator
|
|||||||
def description_for_user(user)
|
def description_for_user(user)
|
||||||
info = UserAssociatedAccount.find_by(provider_name: name, user_id: user.id)&.info
|
info = UserAssociatedAccount.find_by(provider_name: name, user_id: user.id)&.info
|
||||||
return "" if info.nil?
|
return "" if info.nil?
|
||||||
info["email"] || info["nickname"] || info["name"] || ""
|
info["email"] || info["nickname"] || info["name"] || I18n.t("associated_accounts.connected")
|
||||||
end
|
end
|
||||||
|
|
||||||
# These three methods are designed to be overriden by child classes
|
# 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')
|
expect(authenticator.description_for_user(user)).to eq('somenickname')
|
||||||
association.update(info: { nickname: "bestname" })
|
association.update(info: { nickname: "bestname" })
|
||||||
expect(authenticator.description_for_user(user)).to eq('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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user