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

Replace implicit block with named parameter for clarity

Kabiru Mwenja1a46fc834eb9
diff --git a/app/models/work_package/journalized.rb b/app/models/work_package/journalized.rb
index 6b6bd5a10a7..0ff0d06be3f 100644
--- a/app/models/work_package/journalized.rb
+++ b/app/models/work_package/journalized.rb
@@ -30,7 +30,7 @@ module WorkPackage::Journalized
extend ActiveSupport::Concern
included do
- acts_as_journalized do
+ acts_as_journalized journals_association_extension: proc {
def restricted_visible
if OpenProject::FeatureDecisions.comments_with_restricted_visibility_active? &&
User.current.allowed_in_project?(:view_comments_with_restricted_visibility, proxy_association.owner.project)
@@ -39,7 +39,7 @@ module WorkPackage::Journalized
where(restricted: false)
end
end
- end
+ }
# This one is here only to ease reading
module JournalizedProcs
diff --git a/lib_static/plugins/acts_as_journalized/lib/acts_as_journalized.rb b/lib_static/plugins/acts_as_journalized/lib/acts_as_journalized.rb
index 8b2ab573b43..35c595e7aa7 100644
--- a/lib_static/plugins/acts_as_journalized/lib/acts_as_journalized.rb
+++ b/lib_static/plugins/acts_as_journalized/lib/acts_as_journalized.rb
@@ -67,16 +67,18 @@ module Acts
end
# This call will start journaling the model.
- def acts_as_journalized(options = {}, &)
+ def acts_as_journalized(options = {})
return if journaled?
include_aaj_modules
+ journals_association_extension = options.delete(:journals_association_extension) || proc {}
+
prepare_journaled_options(options)
has_many(:journals, -> {
order("#{Journal.table_name}.version ASC")
- }, **has_many_journals_options, &)
+ }, **has_many_journals_options, &journals_association_extension)
end
private