mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 22:21:55 +08:00
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),
|
filters: Discourse.filters.map(&:to_s),
|
||||||
user_fields: UserField.all.map do |userfield|
|
user_fields: UserField.all.map do |userfield|
|
||||||
UserFieldSerializer.new(userfield, root: false, scope: guardian)
|
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
|
end
|
||||||
}.to_json
|
}.to_json
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,7 +69,16 @@ describe Site do
|
||||||
it "includes all enabled authentication providers" do
|
it "includes all enabled authentication providers" do
|
||||||
SiteSetting.enable_twitter_logins = true
|
SiteSetting.enable_twitter_logins = true
|
||||||
SiteSetting.enable_facebook_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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user