DEV: deprecate blank files for static modal pages
This commit is contained in:
parent
2e881adb6e
commit
ad5f5b931d
|
@ -9,6 +9,7 @@ class StaticController < ApplicationController
|
|||
skip_before_action :handle_theme, only: [:brotli_asset, :cdn_asset, :enter, :favicon, :service_worker_asset]
|
||||
|
||||
PAGES_WITH_EMAIL_PARAM = ['login', 'password_reset', 'signup']
|
||||
MODAL_PAGES = ['password_reset', 'signup']
|
||||
|
||||
def show
|
||||
return redirect_to(path '/') if current_user && (params[:id] == 'login' || params[:id] == 'signup')
|
||||
|
@ -69,6 +70,11 @@ class StaticController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
if MODAL_PAGES.include?(@page)
|
||||
render html: nil, layout: true
|
||||
return
|
||||
end
|
||||
|
||||
raise Discourse::NotFound
|
||||
end
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<!-- this file is required to show the password reset modal: /password-reset -->
|
|
@ -1 +0,0 @@
|
|||
<!-- this file is required to show the signup modal: /signup -->
|
|
@ -103,16 +103,6 @@ describe StaticController do
|
|||
expect(response.body).to include(I18n.t('js.faq'))
|
||||
expect(response.body).to include("<title>FAQ - Discourse</title>")
|
||||
end
|
||||
|
||||
it "should return the right response for /signup" do
|
||||
get "/signup"
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "should return the right response for /password-reset" do
|
||||
get "/password-reset"
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
|
||||
[
|
||||
|
@ -149,6 +139,18 @@ describe StaticController do
|
|||
get "/static/does-not-exist"
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
||||
context "modal pages" do
|
||||
it "should return the right response for /signup" do
|
||||
get "/signup"
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "should return the right response for /password-reset" do
|
||||
get "/password-reset"
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'should redirect to / when logged in and path is /login' do
|
||||
|
|
Loading…
Reference in New Issue