Move body class to shared partial for web app controller concern views (#31797)
This commit is contained in:
		
							parent
							
								
									34d7c9edae
								
							
						
					
					
						commit
						297ce9ef44
					
				| @ -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? | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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' | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user