From 0d9ad96d3fbbc3c88cba78d1e1e1a1e5d2a3ad79 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 15 Apr 2024 05:16:59 -0400 Subject: [PATCH] Rename `PremailerWebpackStrategy` -> `PremailerBundledAssetStrategy` (#29934) --- .rubocop_todo.yml | 1 - config/initializers/premailer_rails.rb | 4 ++-- ...ebpack_strategy.rb => premailer_bundled_asset_strategy.rb} | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) rename lib/{premailer_webpack_strategy.rb => premailer_bundled_asset_strategy.rb} (80%) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d7320aa9f89..63d9d675748 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -97,7 +97,6 @@ Style/FetchEnvVar: - 'config/initializers/paperclip.rb' - 'config/initializers/vapid.rb' - 'lib/mastodon/redis_config.rb' - - 'lib/premailer_webpack_strategy.rb' - 'lib/tasks/repo.rake' - 'spec/features/profile_spec.rb' diff --git a/config/initializers/premailer_rails.rb b/config/initializers/premailer_rails.rb index 5e9576be7ab..1c8df970db3 100644 --- a/config/initializers/premailer_rails.rb +++ b/config/initializers/premailer_rails.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -require_relative '../../lib/premailer_webpack_strategy' +require_relative '../../lib/premailer_bundled_asset_strategy' Premailer::Rails.config.merge!(remove_ids: true, adapter: :nokogiri, generate_text_part: false, css_to_attributes: false, - strategies: [PremailerWebpackStrategy]) + strategies: [PremailerBundledAssetStrategy]) diff --git a/lib/premailer_webpack_strategy.rb b/lib/premailer_bundled_asset_strategy.rb similarity index 80% rename from lib/premailer_webpack_strategy.rb rename to lib/premailer_bundled_asset_strategy.rb index 6816d04745a..fbe50cd4fc6 100644 --- a/lib/premailer_webpack_strategy.rb +++ b/lib/premailer_bundled_asset_strategy.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module PremailerWebpackStrategy +module PremailerBundledAssetStrategy def load(url) - asset_host = ENV['CDN_HOST'] || ENV['WEB_DOMAIN'] || ENV['LOCAL_DOMAIN'] + asset_host = ENV['CDN_HOST'] || ENV['WEB_DOMAIN'] || ENV.fetch('LOCAL_DOMAIN', nil) if Webpacker.dev_server.running? asset_host = "#{Webpacker.dev_server.protocol}://#{Webpacker.dev_server.host_with_port}"