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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Remove params argument from BaseCallable#perform
Jan Sandbrink40aff02f115e
diff --git a/app/services/attachments/delete_service.rb b/app/services/attachments/delete_service.rbindex bd1f0924cbb..3b70a8bb476 100644--- a/app/services/attachments/delete_service.rb+++ b/app/services/attachments/delete_service.rb@@ -30,8 +30,9 @@ class Attachments::DeleteService < BaseServices::Deleteinclude Attachments::TouchContainerdef call(params = {})+ self.params = paramsin_context(model.container || model) do- perform(params)+ performendenddiff --git a/app/services/attachments/finish_direct_upload_service.rb b/app/services/attachments/finish_direct_upload_service.rbindex 545a9e10e54..12d59f02c63 100644--- a/app/services/attachments/finish_direct_upload_service.rb+++ b/app/services/attachments/finish_direct_upload_service.rb@@ -46,13 +46,13 @@ module Attachmentsin_context(attachment.container, send_notifications:, &)end- def validate_params(_params)+ def validate_paramssuper.tap do |call|validate_local_file_exists(call)endend- def before_perform(*)+ def before_perform(_)super.tap doset_attachment_parametersenddiff --git a/app/services/base_services/base_callable.rb b/app/services/base_services/base_callable.rbindex d229eacc44f..7b746f3f0cd 100644--- a/app/services/base_services/base_callable.rb+++ b/app/services/base_services/base_callable.rb@@ -39,7 +39,7 @@ module BaseServicesself.params = extract_options!(args).deep_symbolize_keysrun_callbacks(:call) do- perform(*args, **params)+ perform(*args)endenddiff --git a/app/services/base_services/base_contracted.rb b/app/services/base_services/base_contracted.rbindex 88a7873dd28..35a78203c85 100644--- a/app/services/base_services/base_contracted.rb+++ b/app/services/base_services/base_contracted.rb@@ -54,13 +54,13 @@ module BaseServicesin_context(model, send_notifications:, &)end- def perform(params = {})- params, send_notifications = extract(params, :send_notifications)+ def perform+ self.params, send_notifications = extract(params, :send_notifications)service_context(send_notifications:) do- service_call = validate_params(params)- service_call = before_perform(params, service_call) if service_call.success?+ service_call = validate_params+ service_call = before_perform(service_call) if service_call.success?service_call = validate_contract(service_call) if service_call.success?- service_call = after_validate(params, service_call) if service_call.success?+ service_call = after_validate(service_call) if service_call.success?service_call = persist(service_call) if service_call.success?service_call = after_perform(service_call) if service_call.success?@@ -69,19 +69,19 @@ module BaseServicesenddef extract(params, attribute)- params = params ? params.dup : {}- [params, params.delete(attribute)]+ params ||= {}+ [params, params[attribute]]end- def validate_params(_params)+ def validate_paramsServiceResult.success(result: model)end- def before_perform(*)+ def before_perform(_)ServiceResult.success(result: model)end- def after_validate(_params, contract_call)+ def after_validate(contract_call)contract_callenddiff --git a/app/services/base_services/delete.rb b/app/services/base_services/delete.rbindex c0a58d9a89f..b76cddc438c 100644--- a/app/services/base_services/delete.rb+++ b/app/services/base_services/delete.rb@@ -33,8 +33,8 @@ module BaseServicessuper(user:, contract_class:, contract_options:)end- def persist(service_result)- service_result = super(service_result) # rubocop:disable Style/SuperArguments+ def persist(_service_result)+ service_result = superunless destroy(service_result.result)service_result.errors = service_result.result.errorsdiff --git a/app/services/base_services/set_attributes.rb b/app/services/base_services/set_attributes.rbindex e62990c849e..26b46ad6187 100644--- a/app/services/base_services/set_attributes.rb+++ b/app/services/base_services/set_attributes.rb@@ -40,8 +40,8 @@ module BaseServicesself.contract_options = contract_optionsend- def perform(params = {})- set_attributes(params || {})+ def perform+ set_attributes(params)validate_and_resultenddiff --git a/app/services/base_services/write.rb b/app/services/base_services/write.rbindex cb39f7dfc31..453dd392a0f 100644--- a/app/services/base_services/write.rb+++ b/app/services/base_services/write.rb@@ -30,8 +30,8 @@ module BaseServicesclass Write < BaseContractedprotected- def persist(service_result)- service_result = super(service_result) # rubocop:disable Style/SuperArguments+ def persist(_service_result)+ service_result = superunless service_result.result.saveservice_result.errors = service_result.result.errors@@ -47,7 +47,7 @@ module BaseServicesservice_resultend- def before_perform(params, _service_result)+ def before_perform(_service_result)set_attributes(params)enddiff --git a/app/services/bulk_services/project_mappings/base_create_service.rb b/app/services/bulk_services/project_mappings/base_create_service.rbindex 03d7c209301..fea2c8bbd43 100644--- a/app/services/bulk_services/project_mappings/base_create_service.rb+++ b/app/services/bulk_services/project_mappings/base_create_service.rb@@ -41,7 +41,7 @@ module BulkServices@mapping_context = mapping_contextend- def perform(params = {})+ def performservice_call = validate_permissionsservice_call = validate_contract(service_call, params) if service_call.success?service_call = perform_bulk_create(service_call) if service_call.success?diff --git a/app/services/copy/dependency.rb b/app/services/copy/dependency.rbindex e6aca6213c6..6dfed63fb6c 100644--- a/app/services/copy/dependency.rb+++ b/app/services/copy/dependency.rb@@ -79,7 +79,7 @@ module Copyerrors.full_messages.join(". ")end- def perform(params:)+ def performbegincopy_dependency(params:)rescue StandardError => ediff --git a/app/services/custom_fields/create_service.rb b/app/services/custom_fields/create_service.rbindex 314ea55e46e..1593aa93365 100644--- a/app/services/custom_fields/create_service.rb+++ b/app/services/custom_fields/create_service.rb@@ -38,7 +38,7 @@ module CustomFieldsnilend- def perform(params)+ def performsuperrescue StandardError => eServiceResult.failure(message: e.message)diff --git a/app/services/groups/concerns/membership_manipulation.rb b/app/services/groups/concerns/membership_manipulation.rbindex c5fdbbbde27..10122765ddb 100644--- a/app/services/groups/concerns/membership_manipulation.rb+++ b/app/services/groups/concerns/membership_manipulation.rb@@ -30,9 +30,7 @@ module Groups::Concernsmodule MembershipManipulationextend ActiveSupport::Concern- def after_validate(params, _call)- params ||= {}-+ def after_validate(_call)with_error_handled do::Group.transaction dosend_notifications = params.fetch(:send_notifications, Journal::NotificationConfiguration.active?)diff --git a/app/services/members/cleanup_service.rb b/app/services/members/cleanup_service.rbindex f6f1f30ff30..e916ceab962 100644--- a/app/services/members/cleanup_service.rb+++ b/app/services/members/cleanup_service.rb@@ -37,7 +37,7 @@ module Membersprotected- def perform(*)+ def performprune_watchersunassign_categoriesdiff --git a/app/services/oauth_clients/create_service.rb b/app/services/oauth_clients/create_service.rbindex 200c3d46694..a8b2603c0ab 100644--- a/app/services/oauth_clients/create_service.rb+++ b/app/services/oauth_clients/create_service.rb@@ -36,7 +36,7 @@ module OAuthClientsclass CreateService < ::BaseServices::Createprotected- def after_validate(params, contract_call)+ def after_validate(contract_call)OAuthClient.where(integration: params[:integration]).delete_allsuperenddiff --git a/app/services/project_custom_field_project_mappings/bulk_update_service.rb b/app/services/project_custom_field_project_mappings/bulk_update_service.rbindex ee11eba5f0a..53af1963650 100644--- a/app/services/project_custom_field_project_mappings/bulk_update_service.rb+++ b/app/services/project_custom_field_project_mappings/bulk_update_service.rb@@ -35,7 +35,7 @@ module ProjectCustomFieldProjectMappings@project_custom_field_section = project_custom_field_sectionend- def perform(params)+ def performservice_call = validate_permissionsservice_call = perform_bulk_edit(service_call, params) if service_call.success?diff --git a/app/services/project_custom_fields/drop_service.rb b/app/services/project_custom_fields/drop_service.rbindex 0a416228d9b..833bd72365a 100644--- a/app/services/project_custom_fields/drop_service.rb+++ b/app/services/project_custom_fields/drop_service.rb@@ -34,7 +34,7 @@ module ProjectCustomFields@project_custom_field = project_custom_fieldend- def perform(params)+ def performservice_call = validate_permissionsservice_call = perform_drop(service_call, params) if service_call.success?diff --git a/app/services/project_phases/set_attributes_service.rb b/app/services/project_phases/set_attributes_service.rbindex dd5f47dacad..7f261ccb826 100644--- a/app/services/project_phases/set_attributes_service.rb+++ b/app/services/project_phases/set_attributes_service.rb@@ -28,7 +28,7 @@module ProjectPhasesclass SetAttributesService < ::BaseServices::SetAttributes- def perform(*)+ def performsuper.tap doset_calculated_durationenddiff --git a/app/services/project_queries/publish_service.rb b/app/services/project_queries/publish_service.rbindex e291763f6ce..c86b1eeb267 100644--- a/app/services/project_queries/publish_service.rb+++ b/app/services/project_queries/publish_service.rb@@ -30,7 +30,7 @@ module ProjectQueriesclass PublishService < BaseServices::Updateprivate- def after_validate(params, service_call)+ def after_validate(service_call)model.public = params[:public]service_calldiff --git a/app/services/projects/concerns/new_project_service.rb b/app/services/projects/concerns/new_project_service.rbindex 040a63b5d52..34d93f1a205 100644--- a/app/services/projects/concerns/new_project_service.rb+++ b/app/services/projects/concerns/new_project_service.rb@@ -30,13 +30,13 @@ module Projects::Concernsmodule NewProjectServiceprivate- def before_perform(params, service_call)+ def before_perform(service_call)super.tap do |super_call|reject_section_scoped_validation(super_call.result)endend- def after_validate(params, service_call)+ def after_validate(service_call)super.tap do |super_call|build_missing_project_custom_field_project_mappings(super_call.result)enddiff --git a/app/services/projects/copy_service.rb b/app/services/projects/copy_service.rbindex f18b6b31478..4e794ce7c97 100644--- a/app/services/projects/copy_service.rb+++ b/app/services/projects/copy_service.rb@@ -86,7 +86,7 @@ module Projects.merge(target_project_params)end- def before_perform(params, service_call)+ def before_perform(service_call)super.tap do |super_call|# Retain values after the set attributes serviceretain_attributes(source, super_call.result)diff --git a/app/services/projects/enabled_modules_service.rb b/app/services/projects/enabled_modules_service.rbindex eb4ac5cb807..1b4bfc85423 100644--- a/app/services/projects/enabled_modules_service.rb+++ b/app/services/projects/enabled_modules_service.rb@@ -38,7 +38,7 @@ module Projectsprivate- def before_perform(params, _service_result)+ def before_perform(_service_result)model.enabled_module_names = params[:enabled_modules]superenddiff --git a/app/services/projects/enqueue_copy_service.rb b/app/services/projects/enqueue_copy_service.rbindex 7c3b51b5800..23be0188e3f 100644--- a/app/services/projects/enqueue_copy_service.rb+++ b/app/services/projects/enqueue_copy_service.rb@@ -39,7 +39,7 @@ module Projectsprivate- def perform(params)+ def performcall = test_copy(params)if call.success?diff --git a/app/services/projects/schedule_deletion_service.rb b/app/services/projects/schedule_deletion_service.rbindex e1f32f71488..e700ca53067 100644--- a/app/services/projects/schedule_deletion_service.rb+++ b/app/services/projects/schedule_deletion_service.rb@@ -39,7 +39,7 @@ module Projectsprivate- def before_perform(_params, service_result)+ def before_perform(service_result)return service_result if model.archived?Projects::ArchiveServicediff --git a/app/services/relations/create_service.rb b/app/services/relations/create_service.rbindex 37b27353320..c857915ddef 100644--- a/app/services/relations/create_service.rb+++ b/app/services/relations/create_service.rb@@ -32,8 +32,10 @@ class Relations::CreateService < Relations::BaseServiceself.contract_class = Relations::CreateContractend- def perform(send_notifications: nil, **attributes)- in_user_context(send_notifications:) do+ def perform+ attributes = params.except(:send_notifications)++ in_user_context(send_notifications: params[:send_notifications]) doupdate_relation ::Relation.new, attributesendenddiff --git a/app/services/relations/delete_service.rb b/app/services/relations/delete_service.rbindex a856e698db4..ee800009164 100644--- a/app/services/relations/delete_service.rb+++ b/app/services/relations/delete_service.rb@@ -29,7 +29,7 @@class Relations::DeleteService < BaseServices::Deleteinclude Relations::Concerns::Rescheduling- def after_perform(_result)+ def after_perform(_call)result = superif result.success? && deleted_relation.follows?reschedule_result = reschedule_successor(deleted_relation)diff --git a/app/services/relations/update_service.rb b/app/services/relations/update_service.rbindex 23ecc219701..a7166079655 100644--- a/app/services/relations/update_service.rb+++ b/app/services/relations/update_service.rb@@ -35,9 +35,9 @@ class Relations::UpdateService < Relations::BaseServiceself.contract_class = Relations::UpdateContractend- def perform(attributes)- in_user_context(send_notifications: attributes[:send_notifications]) do- update_relation model, attributes+ def perform+ in_user_context(send_notifications: params[:send_notifications]) do+ update_relation model, paramsendendenddiff --git a/app/services/reminders/set_attributes_service.rb b/app/services/reminders/set_attributes_service.rbindex 6c52a2f3708..d55e337a7db 100644--- a/app/services/reminders/set_attributes_service.rb+++ b/app/services/reminders/set_attributes_service.rb@@ -30,7 +30,7 @@module Remindersclass SetAttributesService < ::BaseServices::SetAttributes- def perform(params = {})+ def performremind_at_params = params.extract!(:remind_at_date, :remind_at_time)build_remind_at_from_params(params, remind_at_params) unless params.key?(:remind_at)diff --git a/app/services/roles/create_service.rb b/app/services/roles/create_service.rbindex 95774a71a39..abf1b5830fe 100644--- a/app/services/roles/create_service.rb+++ b/app/services/roles/create_service.rb@@ -29,7 +29,7 @@class Roles::CreateService < BaseServices::Createprivate- def perform(params)+ def performcopy_workflow_id = params.delete(:copy_workflow_from)super_call = superdiff --git a/app/services/roles/update_service.rb b/app/services/roles/update_service.rbindex 46358b9f2d3..c76635960f1 100644--- a/app/services/roles/update_service.rb+++ b/app/services/roles/update_service.rb@@ -29,7 +29,7 @@class Roles::UpdateService < BaseServices::Updateprivate- def before_perform(params, service_call)+ def before_perform(service_call)@permissions_old = service_call.result.permissionssuperenddiff --git a/app/services/settings/working_days_and_hours_update_service.rb b/app/services/settings/working_days_and_hours_update_service.rbindex 648a40870a0..8dc3a64a764 100644--- a/app/services/settings/working_days_and_hours_update_service.rb+++ b/app/services/settings/working_days_and_hours_update_service.rb@@ -35,7 +35,7 @@ class Settings::WorkingDaysAndHoursUpdateService < Settings::UpdateServicesuperend- def validate_params(params)+ def validate_paramscontract = Settings::WorkingDaysAndHoursParamsContract.new(model, user, params:)ServiceResult.new success: contract.valid?,errors: contract.errors,diff --git a/app/services/user_preferences/update_service.rb b/app/services/user_preferences/update_service.rbindex 0c6e867215b..3d9153a898e 100644--- a/app/services/user_preferences/update_service.rb+++ b/app/services/user_preferences/update_service.rb@@ -32,7 +32,7 @@ module UserPreferencesattr_accessor :notifications- def validate_params(params)+ def validate_paramscontract = ParamsContract.new(model, user, params:)ServiceResult.new success: contract.valid?,@@ -40,7 +40,7 @@ module UserPreferencesresult: modelend- def before_perform(params, _service_result)+ def before_perform(_service_result)self.notifications = params&.delete(:notification_settings)superdiff --git a/app/services/users/update_service.rb b/app/services/users/update_service.rbindex 07dedb76ccd..911fe8ffac3 100644--- a/app/services/users/update_service.rb+++ b/app/services/users/update_service.rb@@ -32,7 +32,7 @@ module Usersprotected- def before_perform(params, _service_result)+ def before_perform(_service_result)call_hook :service_update_user_before_save,params:,user: model@@ -40,8 +40,8 @@ module Userssuperend- def persist(service_result)- service_result = super(service_result) # rubocop:disable Style/SuperArguments+ def persist(_service_result)+ service_result = superif service_result.success?service_result.success = model.pref.savediff --git a/app/services/work_packages/activities_tab/comment_attachments_claims/set_attributes_service.rb b/app/services/work_packages/activities_tab/comment_attachments_claims/set_attributes_service.rbindex 2907dd5295e..388204afcee 100644--- a/app/services/work_packages/activities_tab/comment_attachments_claims/set_attributes_service.rb+++ b/app/services/work_packages/activities_tab/comment_attachments_claims/set_attributes_service.rb@@ -36,12 +36,9 @@ module WorkPackagesATTACHMENT_CSS_SELECTOR = "img.op-uc-image"- def perform(params = {})- super(- params.reverse_merge(- attachment_ids: collect_attachment_ids_from_notes- )- )+ def perform+ self.params = params.reverse_merge(attachment_ids: collect_attachment_ids_from_notes)+ superendprivatediff --git a/app/services/work_packages/copy_service.rb b/app/services/work_packages/copy_service.rbindex b8201c46e98..5a90732880d 100644--- a/app/services/work_packages/copy_service.rb+++ b/app/services/work_packages/copy_service.rb@@ -42,23 +42,25 @@ class WorkPackages::CopyService < BaseServices::BaseCallableself.contract_class = contract_classend- def perform(send_notifications: nil, copy_attachments: true, copy_share_members: true, **attributes)- in_context(work_package, send_notifications:) do- copy(attributes, copy_attachments, copy_share_members, send_notifications)+ def perform+ attributes = params.except(:send_notifications, :copy_attachments, :copy_share_members)++ in_context(work_package, send_notifications: params[:send_notifications]) do+ copy(attributes, params[:send_notifications])endendprotected- def copy(attribute_override, copy_attachments, copy_share_members, send_notifications)+ def copy(attribute_override, send_notifications)copied = create(work_package,attribute_override,send_notifications).on_success do |copy_call|remove_author_watcher(copy_call.result)copy_watchers(copy_call.result)- copy_work_package_attachments(copy_call.result) if copy_attachments- copy_share_members(copy_call.result, send_notifications) if copy_share_members+ copy_work_package_attachments(copy_call.result) if copy_attachments?+ copy_share_members(copy_call.result, send_notifications) if copy_share_members?endcopied.state.copied_from_work_package_id = work_package&.id@@ -139,4 +141,12 @@ class WorkPackages::CopyService < BaseServices::BaseCallable.new(user: User.current, contract_class: EmptyContract).call(attributes)end++ def copy_attachments?+ params[:copy_attachments] || params[:copy_attachments].nil?+ end++ def copy_share_members?+ params[:copy_share_members] || params[:copy_share_members].nil?+ endenddiff --git a/app/services/work_packages/create_service.rb b/app/services/work_packages/create_service.rbindex 8f48fecb4ab..40dc7080e6a 100644--- a/app/services/work_packages/create_service.rb+++ b/app/services/work_packages/create_service.rb@@ -40,8 +40,11 @@ class WorkPackages::CreateService < BaseServices::BaseCallable@contract_class = contract_classend- def perform(work_package: WorkPackage.new, send_notifications: nil, **attributes)- in_user_context(send_notifications:) do+ def perform+ attributes = params.except(:send_notifications, :work_package)+ work_package = params[:work_package] || WorkPackage.new++ in_user_context(send_notifications: params[:send_notifications]) docreate(attributes, work_package)endenddiff --git a/docs/release-notes/16-2-0/README.md b/docs/release-notes/16-2-0/README.mdnew file mode 100644index 00000000000..a71b6d9cd5a--- /dev/null+++ b/docs/release-notes/16-2-0/README.md@@ -0,0 +1,45 @@+---+title: OpenProject 16.2.0+sidebar_navigation:+ title: 16.2.0+release_version: 16.2.0+release_date: 2025-07-16+---++# OpenProject 16.2.0++Release date: 2025-07-16++TODO++## Important technical changes++### Breaking: Interface changes to BaseCallable and BaseContracted++The method signatures shared between `BaseServices::BaseCallable`, `BaseServices::BaseContracted` and their subclasses (this includes `BaseServices::Create` and `BaseServices::Update` among others) have been changed.+The method argument `params` was removed, to encourage consistently using the `params` attribute accessor instead. Previously it was+unclear whether using the argument or the accessor should be used, that should be more clear and consistent now.++For plugin developers this means that signatures of the following methods have to be updated accordingly,+if they are defined in a subclass of `BaseServices::BaseContracted`:++* `validate_params(params)` becomes `validate_params`+* `before_perform(params, call)` becomes `before_perform(call)`+* `after_validate(params, call)` becomes `after_validate(call)`++Subclasses of `BaseServices::BaseContracted` need to change `perform` if it previously only accepted keyword-arguments, which are not+passed to `perform` anymore. Positional arguments are still passed as before. Examples:++* `perform(params = {})` becomes `perform` (this is the case for all subclasses of `BaseContracted`)+* `perform(a, b:)` becomes `perform(a)`++## Bug fixes and changes++<!-- Warning: Anything within the below lines will be automatically removed by the release script -->+<!-- BEGIN AUTOMATED SECTION -->+<!-- END AUTOMATED SECTION -->+<!-- Warning: Anything above this line will be automatically removed by the release script -->++## Contributions++TODOdiff --git a/modules/auth_saml/app/services/saml/providers/update_metadata.rb b/modules/auth_saml/app/services/saml/providers/update_metadata.rbindex ef06801f936..e1287f68210 100644--- a/modules/auth_saml/app/services/saml/providers/update_metadata.rb+++ b/modules/auth_saml/app/services/saml/providers/update_metadata.rb@@ -29,7 +29,7 @@module Samlmodule Providersmodule UpdateMetadata- def after_validate(_params, call)+ def after_validate(call)model = call.resultreturn call unless model&.metadata_updated?diff --git a/modules/bim/app/services/bim/bcf/comments/create_service.rb b/modules/bim/app/services/bim/bcf/comments/create_service.rbindex 19470ab373e..8f087c70989 100644--- a/modules/bim/app/services/bim/bcf/comments/create_service.rb+++ b/modules/bim/app/services/bim/bcf/comments/create_service.rb@@ -31,15 +31,15 @@ module Bim::Bcfclass CreateService < ::BaseServices::Createprivate- def before_perform(params, service_result)+ def before_perform(service_result)journal_call = create_journal(params[:issue].work_package,params[:comment])return journal_call if journal_call.failure?- input = { journal: journal_call.result }- .merge(params)- .slice(*::Bim::Bcf::Comment::CREATE_ATTRIBUTES)- super(input, service_result)+ self.params = { journal: journal_call.result }+ .merge(params)+ .slice(*::Bim::Bcf::Comment::CREATE_ATTRIBUTES)+ superenddef create_journal(work_package, comment)diff --git a/modules/bim/app/services/bim/bcf/comments/update_service.rb b/modules/bim/app/services/bim/bcf/comments/update_service.rbindex 176e9742ffe..b97c585cff4 100644--- a/modules/bim/app/services/bim/bcf/comments/update_service.rb+++ b/modules/bim/app/services/bim/bcf/comments/update_service.rb@@ -31,11 +31,12 @@ module Bim::Bcfclass UpdateService < ::BaseServices::Updateprivate- def before_perform(params, service_result)+ def before_perform(service_result)journal_call = update_journal(params[:original_comment].journal, params[:comment])return journal_call if journal_call.failure?- super(params.slice(*::Bim::Bcf::Comment::UPDATE_ATTRIBUTES), service_result)+ self.params = params.slice(*::Bim::Bcf::Comment::UPDATE_ATTRIBUTES)+ superenddef update_journal(journal, comment)diff --git a/modules/bim/app/services/bim/bcf/issues/create_service.rb b/modules/bim/app/services/bim/bcf/issues/create_service.rbindex 20d5004db54..38302bda10f 100644--- a/modules/bim/app/services/bim/bcf/issues/create_service.rb+++ b/modules/bim/app/services/bim/bcf/issues/create_service.rb@@ -31,11 +31,12 @@ module Bim::Bcfclass CreateService < ::BaseServices::Createprivate- def before_perform(params, service_result)+ def before_perform(service_result)wp_call = get_work_package paramsreturn wp_call if wp_call.failure?- super(issue_params(work_package: wp_call.result, params:), service_result)+ self.params = issue_params(work_package: wp_call.result, params:)+ superenddef issue_params(work_package:, params:)diff --git a/modules/bim/app/services/bim/bcf/issues/delete_service.rb b/modules/bim/app/services/bim/bcf/issues/delete_service.rbindex 88d177e0e02..a52c41ac895 100644--- a/modules/bim/app/services/bim/bcf/issues/delete_service.rb+++ b/modules/bim/app/services/bim/bcf/issues/delete_service.rb@@ -31,7 +31,7 @@ module Bim::Bcfclass DeleteService < ::BaseServices::Deleteprivate- def after_validate(params, contract_call)+ def after_validate(contract_call)wp_call = work_package_delete_call(params)if wp_call.success?diff --git a/modules/bim/app/services/bim/bcf/issues/update_service.rb b/modules/bim/app/services/bim/bcf/issues/update_service.rbindex aa428783c5e..2a095becd4f 100644--- a/modules/bim/app/services/bim/bcf/issues/update_service.rb+++ b/modules/bim/app/services/bim/bcf/issues/update_service.rb@@ -31,7 +31,7 @@ module Bim::Bcfclass UpdateService < ::BaseServices::Updateprivate- def before_perform(params, service_result)+ def before_perform(service_result)wp_call = ::WorkPackages::UpdateService.new(model: model.work_package,user:,@@ -39,9 +39,9 @@ module Bim::Bcf.call(**params)if wp_call.success?- issue_params = params.slice(*Bim::Bcf::Issue::SETTABLE_ATTRIBUTES)+ self.params = params.slice(*Bim::Bcf::Issue::SETTABLE_ATTRIBUTES)- super(issue_params, service_result)+ superelsewp_callenddiff --git a/modules/bim/app/services/bim/ifc_models/update_service.rb b/modules/bim/app/services/bim/ifc_models/update_service.rbindex 4933c72cb17..9e464047e14 100644--- a/modules/bim/app/services/bim/ifc_models/update_service.rb+++ b/modules/bim/app/services/bim/ifc_models/update_service.rb@@ -31,7 +31,7 @@ module Bimclass UpdateService < ::BaseServices::Updateprotected- def before_perform(params, _service_result)+ def before_perform(_service_result)@ifc_attachment_updated = params[:ifc_attachment].present?superdiff --git a/modules/boards/app/services/boards/base_create_service.rb b/modules/boards/app/services/boards/base_create_service.rbindex 942c0208875..eca49a7e383 100644--- a/modules/boards/app/services/boards/base_create_service.rb+++ b/modules/boards/app/services/boards/base_create_service.rb@@ -13,14 +13,15 @@ module Boards)end- def before_perform(params, _service_result)+ def before_perform(_service_result)return super if no_widgets_initially?create_query_result = create_query(params)return create_query_result if create_query_result.failure?- super(params.merge(query_id: create_query_result.result.id), create_query_result)+ params[:query_id] = create_query_result.result.id+ super(create_query_result)enddef set_attributes_params(params)diff --git a/modules/boards/app/services/boards/version_board_create_service.rb b/modules/boards/app/services/boards/version_board_create_service.rbindex d7b518de823..0d1fd0e3847 100644--- a/modules/boards/app/services/boards/version_board_create_service.rb+++ b/modules/boards/app/services/boards/version_board_create_service.rb@@ -4,7 +4,7 @@ module Boardsclass VersionBoardCreateService < BaseCreateServiceprotected- def before_perform(params, _service_result)+ def before_perform(_service_result)create_queries_results = create_queries(params)return create_queries_results.find(&:failure?) if create_queries_results.any?(&:failure?)diff --git a/modules/calendar/app/services/calendar/create_ical_service.rb b/modules/calendar/app/services/calendar/create_ical_service.rbindex bec1fb0d6df..77713191dad 100644--- a/modules/calendar/app/services/calendar/create_ical_service.rb+++ b/modules/calendar/app/services/calendar/create_ical_service.rb@@ -33,7 +33,9 @@ module Calendarinclude ActionView::Helpers::SanitizeHelperinclude TextFormattingHelper- def perform(work_packages:, calendar_name:)+ def perform+ work_packages = params.fetch(:work_packages)+ calendar_name = params.fetch(:calendar_name)ical_string = create_ical_string(work_packages, calendar_name)ServiceResult.success(result: ical_string)diff --git a/modules/calendar/app/services/calendar/generate_ical_url_service.rb b/modules/calendar/app/services/calendar/generate_ical_url_service.rbindex 0f0ced4a347..72f098388d7 100644--- a/modules/calendar/app/services/calendar/generate_ical_url_service.rb+++ b/modules/calendar/app/services/calendar/generate_ical_url_service.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -28,32 +30,33 @@module Calendarclass GenerateICalUrlService < ::BaseServices::BaseCallable- def perform(user:, query_id:, project_id:, token_name:)- new_ical_token = create_ical_token(user, query_id, token_name)+ def perform+ query_id = params.fetch(:query_id)+ new_ical_token = create_ical_token(query_id)if new_ical_token.errors.any?ServiceResult.failure(errors: new_ical_token.errors)elsenew_ical_token_value = new_ical_token.plain_value- new_ical_url = create_ical_url(query_id, project_id, new_ical_token_value)+ new_ical_url = create_ical_url(query_id, new_ical_token_value)ServiceResult.success(result: new_ical_url)endendprotected- def create_ical_token(user, query_id, name)+ def create_ical_token(query_id)query = Query.find(query_id)- Token::ICal.create(user:,- ical_token_query_assignment_attributes: { query:, name: })+ Token::ICal.create(user: params.fetch(:user),+ ical_token_query_assignment_attributes: { query:, name: params.fetch(:token_name) })end- def create_ical_url(query_id, project_id, ical_token)+ def create_ical_url(query_id, ical_token)OpenProject::StaticRouting::StaticRouter.new.url_helpers.ical_project_calendar_url(id: query_id,- project_id:,+ project_id: params.fetch(:project_id),ical_token:)enddiff --git a/modules/calendar/app/services/calendar/ical_response_service.rb b/modules/calendar/app/services/calendar/ical_response_service.rbindex c635b0c9e5f..9279670fa94 100644--- a/modules/calendar/app/services/calendar/ical_response_service.rb+++ b/modules/calendar/app/services/calendar/ical_response_service.rb@@ -35,7 +35,9 @@ module Calendarself.contract_class = Queries::ICalSharingContractend- def perform(ical_token_string:, query_id:)+ def perform+ ical_token_string = params.fetch(:ical_token_string)+ query_id = params.fetch(:query_id)ical_token_instance = resolve_ical_token(ical_token_string)user = ical_token_instance.userdiff --git a/modules/calendar/app/services/calendar/resolve_ical_token_service.rb b/modules/calendar/app/services/calendar/resolve_ical_token_service.rbindex 25be3f21da6..5691a9086cf 100644--- a/modules/calendar/app/services/calendar/resolve_ical_token_service.rb+++ b/modules/calendar/app/services/calendar/resolve_ical_token_service.rb@@ -28,7 +28,8 @@module Calendarclass ResolveICalTokenService < ::BaseServices::BaseCallable- def perform(ical_token_string:)+ def perform+ ical_token_string = params.fetch(:ical_token_string)if ical_token_string.blank?raise ActiveRecord::RecordNotFoundenddiff --git a/modules/calendar/app/services/calendar/resolve_work_packages_service.rb b/modules/calendar/app/services/calendar/resolve_work_packages_service.rbindex 04d2dc3c853..ed48413438b 100644--- a/modules/calendar/app/services/calendar/resolve_work_packages_service.rb+++ b/modules/calendar/app/services/calendar/resolve_work_packages_service.rb@@ -28,7 +28,8 @@module Calendarclass ResolveWorkPackagesService < ::BaseServices::BaseCallable- def perform(query:)+ def perform+ query = params.fetch(:query)raise ActiveRecord::RecordNotFound if query.nil?query.remove_filter(:dates_interval)diff --git a/modules/grids/app/services/grids/update_service.rb b/modules/grids/app/services/grids/update_service.rbindex 30e3e24faf7..9afe9dc20d4 100644--- a/modules/grids/app/services/grids/update_service.rb+++ b/modules/grids/app/services/grids/update_service.rb@@ -29,8 +29,8 @@class Grids::UpdateService < BaseServices::Updateprotected- def perform(attributes)- set_type_for_error_message(attributes.delete(:scope))+ def perform+ set_type_for_error_message(params.delete(:scope))superenddiff --git a/modules/meeting/app/services/meeting_agenda_items/drop_service.rb b/modules/meeting/app/services/meeting_agenda_items/drop_service.rbindex ddee2446ef2..69bca2be9b1 100644--- a/modules/meeting/app/services/meeting_agenda_items/drop_service.rb+++ b/modules/meeting/app/services/meeting_agenda_items/drop_service.rb@@ -38,7 +38,7 @@ module MeetingAgendaItems@meeting = meeting_agenda_item.meetingend- def perform(params)+ def performservice_call = validate_permissionservice_call = validate_meeting_existence if service_call.success?service_call = validate_meeting_agenda_item_editable if service_call.success?diff --git a/modules/meeting/app/services/meetings/delete_service.rb b/modules/meeting/app/services/meetings/delete_service.rbindex 01cfcd8ab39..d9a4884afc3 100644--- a/modules/meeting/app/services/meetings/delete_service.rb+++ b/modules/meeting/app/services/meetings/delete_service.rb@@ -32,7 +32,7 @@ module Meetingsclass DeleteService < ::BaseServices::Deleteprotected- def after_validate(_, call)+ def after_validate(call)send_cancellation_mail(model)cancel_scheduled_meeting(model)diff --git a/modules/meeting/app/services/recurring_meetings/delete_service.rb b/modules/meeting/app/services/recurring_meetings/delete_service.rbindex 4287dcffa65..774a2889fe7 100644--- a/modules/meeting/app/services/recurring_meetings/delete_service.rb+++ b/modules/meeting/app/services/recurring_meetings/delete_service.rb@@ -36,7 +36,7 @@ module RecurringMeetingsMeetings::DeleteContractend- def after_validate(_, call)+ def after_validate(call)send_cancellation_mail(model)calldiff --git a/modules/meeting/app/services/recurring_meetings/init_occurrence_service.rb b/modules/meeting/app/services/recurring_meetings/init_occurrence_service.rbindex e9124ea39fb..58093bfe685 100644--- a/modules/meeting/app/services/recurring_meetings/init_occurrence_service.rb+++ b/modules/meeting/app/services/recurring_meetings/init_occurrence_service.rb@@ -41,7 +41,8 @@ module RecurringMeetingsprotected- def perform(start_time:)+ def perform+ start_time = params.fetch(:start_time)in_context(recurring_meeting, send_notifications: false) docall = instantiate(start_time)create_schedule(call) if call.success?diff --git a/modules/meeting/app/services/recurring_meetings/update_service.rb b/modules/meeting/app/services/recurring_meetings/update_service.rbindex a49d465f3b4..17b16344aea 100644--- a/modules/meeting/app/services/recurring_meetings/update_service.rb+++ b/modules/meeting/app/services/recurring_meetings/update_service.rb@@ -34,7 +34,7 @@ module RecurringMeetingsprotected- def validate_params(*)+ def validate_params@old_schedule = model.full_schedule_in_wordssuperenddiff --git a/modules/meeting/app/services/recurring_meetings/with_template.rb b/modules/meeting/app/services/recurring_meetings/with_template.rbindex c9276c6de66..4aeb1e55b24 100644--- a/modules/meeting/app/services/recurring_meetings/with_template.rb+++ b/modules/meeting/app/services/recurring_meetings/with_template.rb@@ -34,7 +34,7 @@ module RecurringMeetingsincluded doattr_accessor :template_params- def before_perform(params, _)+ def before_perform(_)@template_params = extract_template_params(params)superdiff --git a/modules/openid_connect/app/services/openid_connect/providers/update_service.rb b/modules/openid_connect/app/services/openid_connect/providers/update_service.rbindex fb21afd9b7d..4c1d4e65d79 100644--- a/modules/openid_connect/app/services/openid_connect/providers/update_service.rb+++ b/modules/openid_connect/app/services/openid_connect/providers/update_service.rb@@ -50,7 +50,7 @@ module OpenIDConnect@fetch_metadata = fetch_metadataend- def after_validate(_params, call)+ def after_validate(call)model = call.resultmetadata_url = get_metadata_url(model)return call if metadata_url.blank? || !@fetch_metadatadiff --git a/spec/services/base/base_callable_spec.rb b/spec/services/base/base_callable_spec.rbindex 4f570c6ed36..9a31646c4f1 100644--- a/spec/services/base/base_callable_spec.rb+++ b/spec/services/base/base_callable_spec.rb@@ -33,7 +33,7 @@ require "spec_helper"RSpec.describe BaseServices::BaseCallable, type: :model dolet(:test_service) doClass.new(BaseServices::BaseCallable) do- def perform(*)+ def performstate.test = "foo"ServiceResult.success(result: "something")end@@ -42,7 +42,7 @@ RSpec.describe BaseServices::BaseCallable, type: :model dolet(:test_service2) doClass.new(BaseServices::BaseCallable) do- def perform(*)+ def performstate.test2 = "foo"ServiceResult.success(result: "something")enddiff --git a/spec/services/reminders/set_attributes_service_spec.rb b/spec/services/reminders/set_attributes_service_spec.rbindex 1f49dcd2914..5804ee862d4 100644--- a/spec/services/reminders/set_attributes_service_spec.rb+++ b/spec/services/reminders/set_attributes_service_spec.rb@@ -54,7 +54,7 @@ RSpec.describe Reminders::SetAttributesService docreator: user}- service.perform(params)+ service.call(params)expect(model_instance).to have_attributes(remind_at: current_user.time_zone.parse("2023-10-01 12:00"),@@ -75,7 +75,7 @@ RSpec.describe Reminders::SetAttributesService docreator: user}- model_result = service.perform(params).result+ model_result = service.call(params).resultexpect(model_result).to have_attributes(remind_at: current_user.time_zone.parse("2027-10-01 08:00"),@@ -89,17 +89,17 @@ RSpec.describe Reminders::SetAttributesService docontext "when remind_at_date or remind_at_time is not provided" doit "does not set the remind_at attribute" doaggregate_failures "one is nil" do- service.perform(remind_at_date: nil, remind_at_time: "12:00")+ service.call(remind_at_date: nil, remind_at_time: "12:00")expect(model_instance.remind_at).to be_nilendaggregate_failures "both are nil" do- service.perform(remind_at_date: nil, remind_at_time: nil)+ service.call(remind_at_date: nil, remind_at_time: nil)expect(model_instance.remind_at).to be_nilendaggregate_failures "none provided" do- service.perform({})+ service.call({})expect(model_instance.remind_at).to be_nilendend@@ -110,7 +110,7 @@ RSpec.describe Reminders::SetAttributesService docontext "and neither remind_at, remind_at_date nor remind_at_time are provided" doit "does not change the remind_at attribute" do- contract_call = service.perform({})+ contract_call = service.call({})model_result = contract_call.resultexpect(model_result.remind_at).to eq(model_instance.remind_at)@@ -125,7 +125,7 @@ RSpec.describe Reminders::SetAttributesService docontext "with remind_at blank active model error" doit "adds blank errors for `remind_at_date` and `remind_at_time` attributes" do- result = service.perform({})+ result = service.call({})expect(result).to be_failureexpect(result.errors.messages).to include(@@ -140,7 +140,7 @@ RSpec.describe Reminders::SetAttributesService dolet(:remind_at_time) { 1.hour.ago.strftime("%H:%M") }it "adds errors for `remind_at_date` and `remind_at_time` attributes" do- result = service.perform(remind_at_date:, remind_at_time:)+ result = service.call(remind_at_date:, remind_at_time:)expect(result).to be_failureexpect(result.errors.messages).to include(diff --git a/spec/services/work_package_types/set_attributes_service_spec.rb b/spec/services/work_package_types/set_attributes_service_spec.rbindex 08c535061df..68537c94f98 100644--- a/spec/services/work_package_types/set_attributes_service_spec.rb+++ b/spec/services/work_package_types/set_attributes_service_spec.rb@@ -42,18 +42,18 @@ module WorkPackageTypeslet(:params) { { patterns: "vader_s_rubber_duck" } }it "fails" do- result = service.perform(params)+ result = service.call(params)expect(result).to be_failureendit "adds an error on the patterns atrribute" do- result = service.perform(params)+ result = service.call(params)expect(result.errors.details).to eq(patterns: [{ error: :is_invalid }])endit "does not override the already existing value on the model" do- service.perform(params)+ service.call(params)expect(model).not_to be_changedendend@@ -62,17 +62,17 @@ module WorkPackageTypeslet(:params) { { patterns: { subject: { blueprint: "{{author}}" } } } }it "fails" do- result = service.perform(params)+ result = service.call(params)expect(result).to be_failureendit "adds an error on the patterns attribute" do- result = service.perform(params)+ result = service.call(params)expect(result.errors.details).to eq(patterns: [{ error: "Enabled is missing" }])endit "does not override the already existing value on the model" do- service.perform(params)+ service.call(params)expect(model).not_to be_changedendend@@ -81,11 +81,11 @@ module WorkPackageTypeslet(:params) { { patterns: nil } }it "succeeds" do- expect(service.perform(params)).to be_success+ expect(service.call(params)).to be_successendit "sets the patterns to an empty collection" do- service.perform(params)+ service.call(params)expect(model.patterns).to eq(Types::Patterns::Collection.empty)endend@@ -94,17 +94,17 @@ module WorkPackageTypeslet(:params) { { copy_workflow_from: "1337" } }it "fails" do- result = service.perform(params)+ result = service.call(params)expect(result).to be_failureendit "adds an error on the copy_workflow_from attribute" do- result = service.perform(params)+ result = service.call(params)expect(result.errors.details).to eq(copy_workflow_from: [{ error: "Type for workflow copy not found." }])endit "does not override the already existing value on the model" do- service.perform(params)+ service.call(params)expect(model).not_to be_changedendend@@ -114,17 +114,17 @@ module WorkPackageTypeslet(:params) { { copy_workflow_from: wp_type.id.to_s } }it "fails" do- result = service.perform(params)+ result = service.call(params)expect(result).to be_failureendit "adds an error on the copy_workflow_from attribute" do- result = service.perform(params)+ result = service.call(params)expect(result.errors.details).to eq(copy_workflow_from: [{ error: "Type for workflow copy has no own workflow." }])endit "does not override the already existing value on the model" do- service.perform(params)+ service.call(params)expect(model).not_to be_changedendend@@ -134,17 +134,17 @@ module WorkPackageTypeslet(:params) { { project_ids: [project.id.to_s, "1337"] } }it "fails" do- result = service.perform(params)+ result = service.call(params)expect(result).to be_failureendit "adds an error on the project_ids attribute" do- result = service.perform(params)+ result = service.call(params)expect(result.errors.details).to eq(project_ids: [{ error: "Projects with ids 1337 do not exist." }])endit "does not override the already existing value on the model" do- service.perform(params)+ service.call(params)expect(model).not_to be_changedendend