From 2d667a3bd05cb370c8d3356d69cadb44e5c8ae72 Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Fri, 18 Dec 2020 02:27:32 +0300 Subject: [PATCH] FEATURE: Enable inline onebox for all domains by default (#11523) --- config/site_settings.yml | 2 +- lib/inline_oneboxer.rb | 3 +++ spec/components/inline_oneboxer_spec.rb | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/site_settings.yml b/config/site_settings.yml index f5046ee86f4..eb1b37c5800 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -1605,7 +1605,7 @@ onebox: type: list list_type: compact enable_inline_onebox_on_all_domains: - default: false + default: true force_custom_user_agent_hosts: default: "http://codepen.io" type: list diff --git a/lib/inline_oneboxer.rb b/lib/inline_oneboxer.rb index 9536b17061a..303a2c47d0b 100644 --- a/lib/inline_oneboxer.rb +++ b/lib/inline_oneboxer.rb @@ -42,6 +42,9 @@ class InlineOneboxer opts[:post_author] = post_author_for_title(topic, post_number) end return onebox_for(url, topic.title, opts) + else + # not permitted to see topic + return nil end end end diff --git a/spec/components/inline_oneboxer_spec.rb b/spec/components/inline_oneboxer_spec.rb index 7043aa1146d..fc4c3288350 100644 --- a/spec/components/inline_oneboxer_spec.rb +++ b/spec/components/inline_oneboxer_spec.rb @@ -148,6 +148,7 @@ describe InlineOneboxer do end it "will not crawl domains that aren't allowlisted" do + SiteSetting.enable_inline_onebox_on_all_domains = false onebox = InlineOneboxer.lookup("https://eviltrout.com", skip_cache: true) expect(onebox).to be_blank end