From a5df69369797144d1c8a4f3c124c2c5e4ef9af77 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 10 Jun 2021 09:36:41 -0400 Subject: [PATCH] FIX: can't bootstrap with ember-cli when login_required is enabled (#13350) --- app/controllers/bootstrap_controller.rb | 2 ++ spec/requests/bootstrap_controller_spec.rb | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/app/controllers/bootstrap_controller.rb b/app/controllers/bootstrap_controller.rb index 9a52f741a21..0921e0aab81 100644 --- a/app/controllers/bootstrap_controller.rb +++ b/app/controllers/bootstrap_controller.rb @@ -3,6 +3,8 @@ class BootstrapController < ApplicationController include ApplicationHelper + skip_before_action :redirect_to_login_if_required + # This endpoint allows us to produce the data required to start up Discourse via JSON API, # so that you don't have to scrape the HTML for `data-*` payloads def index diff --git a/spec/requests/bootstrap_controller_spec.rb b/spec/requests/bootstrap_controller_spec.rb index d18c3557ac1..182c307191c 100644 --- a/spec/requests/bootstrap_controller_spec.rb +++ b/spec/requests/bootstrap_controller_spec.rb @@ -74,4 +74,11 @@ describe BootstrapController do bootstrap = json['bootstrap'] expect(bootstrap['extra_locales']).to be_present end + + it "returns data when login_required is enabled" do + SiteSetting.login_required = true + get "/bootstrap.json" + expect(response.status).to eq(200) + expect(response.parsed_body).to be_present + end end