Remove instance variables from helper usage (#24203)
This commit is contained in:
parent
e1b4eeb636
commit
0a5f0a8b20
19 changed files with 53 additions and 45 deletions
|
@ -168,7 +168,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def body_classes
|
||||
output = (@body_classes || '').split
|
||||
output = body_class_string.split
|
||||
output << "theme-#{current_theme.parameterize}"
|
||||
output << 'system-font' if current_account&.user&.setting_system_font_ui
|
||||
output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion')
|
||||
|
|
|
@ -9,13 +9,17 @@ module InstanceHelper
|
|||
@site_hostname ||= Addressable::URI.parse("//#{Rails.configuration.x.local_domain}").display_uri.host
|
||||
end
|
||||
|
||||
def description_for_sign_up
|
||||
prefix = if @invite.present?
|
||||
I18n.t('auth.description.prefix_invited_by_user', name: @invite.user.account.username)
|
||||
else
|
||||
I18n.t('auth.description.prefix_sign_up')
|
||||
end
|
||||
def description_for_sign_up(invite = nil)
|
||||
safe_join([description_prefix(invite), I18n.t('auth.description.suffix')], ' ')
|
||||
end
|
||||
|
||||
safe_join([prefix, I18n.t('auth.description.suffix')], ' ')
|
||||
private
|
||||
|
||||
def description_prefix(invite)
|
||||
if invite.present?
|
||||
I18n.t('auth.description.prefix_invited_by_user', name: invite.user.account.username)
|
||||
else
|
||||
I18n.t('auth.description.prefix_sign_up')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -63,11 +63,11 @@ module JsonLdHelper
|
|||
uri.nil? || !uri.start_with?('http://', 'https://')
|
||||
end
|
||||
|
||||
def invalid_origin?(url)
|
||||
return true if unsupported_uri_scheme?(url)
|
||||
def non_matching_uri_hosts?(base_url, comparison_url)
|
||||
return true if unsupported_uri_scheme?(comparison_url)
|
||||
|
||||
needle = Addressable::URI.parse(url).host
|
||||
haystack = Addressable::URI.parse(@account.uri).host
|
||||
needle = Addressable::URI.parse(comparison_url).host
|
||||
haystack = Addressable::URI.parse(base_url).host
|
||||
|
||||
!haystack.casecmp(needle).zero?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue