0
0
Fork 0

ApplicationHelper spec coverage, unused removal, tiny refactor (#24762)

This commit is contained in:
Matt Jankowski 2023-05-02 12:10:39 -04:00 committed by GitHub
parent c26b1b0a1c
commit a7df578f97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 166 additions and 6 deletions

View file

@ -32,10 +32,6 @@ module ApplicationHelper
paths.any? { |path| current_page?(path) } ? 'active' : ''
end
def active_link_to(label, path, **options)
link_to label, path, options.merge(class: active_nav_class(path))
end
def show_landing_strip?
!user_signed_in? && !single_user_mode?
end
@ -173,11 +169,11 @@ module ApplicationHelper
end
def storage_host
"https://#{ENV['S3_ALIAS_HOST'].presence || ENV['S3_CLOUDFRONT_HOST']}"
URI::HTTPS.build(host: storage_host_name).to_s
end
def storage_host?
ENV['S3_ALIAS_HOST'].present? || ENV['S3_CLOUDFRONT_HOST'].present?
storage_host_name.present?
end
def quote_wrap(text, line_width: 80, break_sequence: "\n")
@ -235,4 +231,10 @@ module ApplicationHelper
def prerender_custom_emojis(html, custom_emojis, other_options = {})
EmojiFormatter.new(html, custom_emojis, other_options.merge(animate: prefers_autoplay?)).to_s
end
private
def storage_host_name
ENV.fetch('S3_ALIAS_HOST', nil) || ENV.fetch('S3_CLOUDFRONT_HOST', nil)
end
end