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 1b6a82b799
commit ca3ad2fd0b
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