A platform for community discussion. Free, open, simple.
FIX: Include HTML content for authenticated users with crawler UA (#26757)
David Taylor594026d65ffe
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rbindex 1d5b5794d66..b409efe2183 100644--- a/app/helpers/application_helper.rb+++ b/app/helpers/application_helper.rb@@ -431,7 +431,7 @@ module ApplicationHelperenddef include_crawler_content?- if current_user+ if current_user && !crawler_layout?params.key?(:print)elsecrawler_layout? || !mobile_view? || !modern_mobile_device?diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rbindex 040722f48e3..561005784b7 100644--- a/spec/helpers/application_helper_spec.rb+++ b/spec/helpers/application_helper_spec.rb@@ -19,11 +19,19 @@ RSpec.describe ApplicationHelper doit "sends crawler content to logged on users who wants to print" dohelper.stubs(:current_user).returns(Fabricate(:user))+ controller.stubs(:use_crawler_layout?).returns(false)helper.stubs(:params).returns(print: true)expect(helper.include_crawler_content?).to eq(true)end+ it "sends crawler content to logged on users with a crawler user agent" do+ helper.stubs(:current_user).returns(Fabricate(:user))+ controller.stubs(:use_crawler_layout?).returns(true)++ expect(helper.include_crawler_content?).to eq(true)+ end+it "sends crawler content to old mobiles" docontroller.stubs(:use_crawler_layout?).returns(false)