Move body class to shared partial for web app controller concern views (#31797)

This commit is contained in:
Matt Jankowski 2024-11-15 10:49:26 -05:00 committed by GitHub
parent 34d7c9edae
commit 297ce9ef44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 6 additions and 5 deletions

View file

@ -7,7 +7,6 @@ module WebAppControllerConcern
vary_by 'Accept, Accept-Language, Cookie' vary_by 'Accept, Accept-Language, Cookie'
before_action :redirect_unauthenticated_to_permalinks! before_action :redirect_unauthenticated_to_permalinks!
before_action :set_app_body_class
content_security_policy do |p| content_security_policy do |p|
policy = ContentSecurityPolicy.new policy = ContentSecurityPolicy.new
@ -24,10 +23,6 @@ module WebAppControllerConcern
!(ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && ENV['OMNIAUTH_ONLY'] == 'true' && Devise.omniauth_providers.length == 1) && current_user.nil? !(ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && ENV['OMNIAUTH_ONLY'] == 'true' && Devise.omniauth_providers.length == 1) && current_user.nil?
end end
def set_app_body_class
@body_classes = 'app-body'
end
def redirect_unauthenticated_to_permalinks! def redirect_unauthenticated_to_permalinks!
return if user_signed_in? && current_account.moved_to_account_id.nil? return if user_signed_in? && current_account.moved_to_account_id.nil?

View file

@ -1,3 +1,4 @@
- content_for :body_classes, 'app-body'
- content_for :header_tags do - content_for :header_tags do
- if user_signed_in? - if user_signed_in?
= preload_pack_asset 'features/compose.js' = preload_pack_asset 'features/compose.js'

View file

@ -8,5 +8,6 @@ RSpec.describe 'About page' do
expect(page) expect(page)
.to have_css('noscript', text: /Mastodon/) .to have_css('noscript', text: /Mastodon/)
.and have_css('body', class: 'app-body')
end end
end end

View file

@ -11,6 +11,7 @@ RSpec.describe 'Home page' do
expect(page) expect(page)
.to have_css('noscript', text: /Mastodon/) .to have_css('noscript', text: /Mastodon/)
.and have_css('body', class: 'app-body')
end end
end end
@ -20,6 +21,7 @@ RSpec.describe 'Home page' do
expect(page) expect(page)
.to have_css('noscript', text: /Mastodon/) .to have_css('noscript', text: /Mastodon/)
.and have_css('body', class: 'app-body')
end end
end end
end end

View file

@ -8,5 +8,6 @@ RSpec.describe 'Privacy policy page' do
expect(page) expect(page)
.to have_css('noscript', text: /Mastodon/) .to have_css('noscript', text: /Mastodon/)
.and have_css('body', class: 'app-body')
end end
end end

View file

@ -13,6 +13,7 @@ RSpec.describe 'Tags' do
expect(page) expect(page)
.to have_css('noscript', text: /Mastodon/) .to have_css('noscript', text: /Mastodon/)
.and have_css('body', class: 'app-body')
.and have_private_cache_control .and have_private_cache_control
end end
end end