From 8669c87b94869cbdf0934c90d1010004b603c221 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Mon, 27 Oct 2025 20:36:32 +0000 Subject: [PATCH] Updates propshaft to 1.3. Patch by Takashi Kato (user:tohosaku). git-svn-id: https://svn.redmine.org/redmine/trunk@24074 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- Gemfile | 2 +- app/helpers/application_helper.rb | 6 ++++-- lib/redmine/asset_path.rb | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 52108b6ba..ccba15c7e 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'i18n', '~> 1.14.1' gem 'rbpdf', '~> 1.21.4' gem 'addressable' gem 'rubyzip', '~> 3.1.1' -gem 'propshaft', '~> 1.1.0' +gem 'propshaft', '~> 1.3.0' gem 'rack', '>= 3.1.3' gem "stimulus-rails", "~> 1.3" gem "importmap-rails", "~> 2.0" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1bdc29d81..883960540 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1744,7 +1744,8 @@ module ApplicationHelper # stylesheet_link_tag('styles', :plugin => 'foo) # => picks styles.css from plugin's assets # def stylesheet_link_tag(*sources) - options = sources.last.is_a?(Hash) ? sources.pop : {} + # option keys is converted to a string in Propshaft::Helper. + options = sources.last.is_a?(Hash) ? sources.pop.symbolize_keys : {} plugin = options.delete(:plugin) sources = sources.map do |source| if plugin @@ -1778,7 +1779,8 @@ module ApplicationHelper # javascript_include_tag('scripts', :plugin => 'foo) # => picks scripts.js from plugin's assets # def javascript_include_tag(*sources) - options = sources.last.is_a?(Hash) ? sources.pop : {} + # option keys is converted to a string in Propshaft::Helper. + options = sources.last.is_a?(Hash) ? sources.pop.symbolize_keys : {} if plugin = options.delete(:plugin) sources = sources.map do |source| if plugin diff --git a/lib/redmine/asset_path.rb b/lib/redmine/asset_path.rb index 4c7959a58..599c479e8 100644 --- a/lib/redmine/asset_path.rb +++ b/lib/redmine/asset_path.rb @@ -135,7 +135,11 @@ module Redmine def initialize(config, compilers) @extension_paths = config.redmine_extension_paths @default_asset_path = config.redmine_default_asset_path - super(config.paths, compilers: compilers, version: config.version) + super(config.paths, + compilers: compilers, + version: config.version, + file_watcher: config.file_watcher, + integrity_hash_algorithm: config.integrity_hash_algorithm) end def asset_files @@ -172,7 +176,7 @@ module Redmine @cache_sweeper ||= begin exts_to_watch = Mime::EXTENSION_LOOKUP.map(&:first) files_to_watch = Array(all_paths).to_h { |dir| [dir.to_s, exts_to_watch] } - Rails.application.config.file_watcher.new([], files_to_watch) do + @file_watcher.new([], files_to_watch) do clear_cache end end