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 method call instead

Kabiru Mwenja357b68b331aa
diff --git a/app/components/work_packages/activities_tab/index_component.rb b/app/components/work_packages/activities_tab/index_component.rb
index f63f0c2eca2..3f44c80f57d 100644
--- a/app/components/work_packages/activities_tab/index_component.rb
+++ b/app/components/work_packages/activities_tab/index_component.rb
@@ -73,7 +73,7 @@ module WorkPackages
controller: restricted_comment_stimulus_controller,
"application-target": "dynamic",
restricted_comment_stimulus_controller("-target") => "formContainer",
- action: "#{index_stimulus_controller}:onSubmit-end@window->#{restricted_comment_stimulus_controller}#onSubmitEnd",
+ action: index_stimulus_controller(":onSubmit-end@window->#{restricted_comment_stimulus_controller}#onSubmitEnd"),
restricted_comment_stimulus_controller("-highlight-class") => "work-packages-activities-tab-journals-new-component--journal-notes-body__restricted-comment", # rubocop:disable Layout/LineLength
restricted_comment_stimulus_controller("-hidden-class") => "d-none",
restricted_comment_stimulus_controller("-#{index_stimulus_controller}-outlet") => "##{wrapper_key}"
diff --git a/app/controllers/work_packages/activities_tab_controller.rb b/app/controllers/work_packages/activities_tab_controller.rb
index 9556c1b4bf8..e96e4725049 100644
--- a/app/controllers/work_packages/activities_tab_controller.rb
+++ b/app/controllers/work_packages/activities_tab_controller.rb
@@ -295,14 +295,16 @@ class WorkPackages::ActivitiesTabController < ApplicationController
end
def create_journal_service_call
- to_boolean = ->(value, default) { ActiveRecord::Type::Boolean.new.cast(value.presence || default) }
-
AddWorkPackageNoteService
.new(user: User.current,
work_package: @work_package)
.call(journal_params[:notes],
- send_notifications: to_boolean.call(params[:notify], true),
- restricted: to_boolean.call(journal_params[:restricted], false))
+ send_notifications: to_boolean(params[:notify], true),
+ restricted: to_boolean(journal_params[:restricted], false))
+ end
+
+ def to_boolean(value, default)
+ ActiveRecord::Type::Boolean.new.cast(value.presence || default)
end
def update_journal_service_call