Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

use active_support hook for patching

ulferts92d00affca0f
diff --git a/app/helpers/avatar_helper.rb b/app/helpers/avatar_helper.rb
index 40dadf9c3af..3136dbe3e62 100644
--- a/app/helpers/avatar_helper.rb
+++ b/app/helpers/avatar_helper.rb
@@ -38,3 +38,5 @@ module AvatarHelper
''.html_safe
end
end
+
+ActiveSupport.run_load_hooks(:op_helpers_avatar, AvatarHelper)
diff --git a/modules/avatars/lib/open_project/avatars/engine.rb b/modules/avatars/lib/open_project/avatars/engine.rb
index f81701d5516..fe034de716b 100644
--- a/modules/avatars/lib/open_project/avatars/engine.rb
+++ b/modules/avatars/lib/open_project/avatars/engine.rb
@@ -53,12 +53,11 @@ module OpenProject::Avatars
only_if: ->(*) { User.current.admin? && ::OpenProject::Avatars::AvatarManager.avatars_enabled? }
initializer 'patch avatar helper' do
- # This is required to be an initializer,
- # since the helpers are included as soon as the ApplicationController
- # gets autoloaded, which is BEFORE config.to_prepare.
Rails.autoloaders.main.ignore(config.root.join('lib/open_project/avatars/patches/avatar_helper_patch.rb'))
- require_relative './patches/avatar_helper_patch'
+ ActiveSupport.on_load(:op_helpers_avatar) do
+ require_relative './patches/avatar_helper_patch'
+ end
end
patches %i[User]