Move body class to shared partial for web app controller concern views

This commit is contained in:
Matt Jankowski 2024-09-06 14:17:52 -04:00
parent f91f077985
commit 02fbc45b6c
6 changed files with 6 additions and 5 deletions

View File

@ -7,7 +7,6 @@ module WebAppControllerConcern
vary_by 'Accept, Accept-Language, Cookie'
before_action :redirect_unauthenticated_to_permalinks!
before_action :set_app_body_class
content_security_policy do |p|
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?
end
def set_app_body_class
@body_classes = 'app-body'
end
def redirect_unauthenticated_to_permalinks!
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
- if user_signed_in?
= preload_pack_asset 'features/compose.js'

View File

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

View File

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

View File

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

View File

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