FIX: Include auth_providers for anonymous users when login_required
This commit is contained in:
parent
9e63ebdf0f
commit
aa9a9a5a72
|
@ -91,6 +91,9 @@ class Site
|
|||
filters: Discourse.filters.map(&:to_s),
|
||||
user_fields: UserField.all.map do |userfield|
|
||||
UserFieldSerializer.new(userfield, root: false, scope: guardian)
|
||||
end,
|
||||
auth_providers: Discourse.enabled_auth_providers.map do |provider|
|
||||
AuthProviderSerializer.new(provider, root: false, scope: guardian)
|
||||
end
|
||||
}.to_json
|
||||
end
|
||||
|
|
|
@ -69,7 +69,16 @@ describe Site do
|
|||
it "includes all enabled authentication providers" do
|
||||
SiteSetting.enable_twitter_logins = true
|
||||
SiteSetting.enable_facebook_logins = true
|
||||
expect(Site.new(Guardian.new).auth_providers.map(&:name)).to contain_exactly('facebook', 'twitter')
|
||||
data = JSON.parse(Site.json_for(Guardian.new))
|
||||
expect(data["auth_providers"].map { |a| a["name"] }).to contain_exactly('facebook', 'twitter')
|
||||
end
|
||||
|
||||
it "includes all enabled authentication providers for anon when login_required" do
|
||||
SiteSetting.login_required = true
|
||||
SiteSetting.enable_twitter_logins = true
|
||||
SiteSetting.enable_facebook_logins = true
|
||||
data = JSON.parse(Site.json_for(Guardian.new))
|
||||
expect(data["auth_providers"].map { |a| a["name"] }).to contain_exactly('facebook', 'twitter')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue