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

refactor: move responsibility of creator assignment in the SetAttributesService

Christophe Bliard4722323d1208
diff --git a/modules/storages/app/services/storages/file_links/set_attributes_service.rb b/modules/storages/app/services/storages/file_links/set_attributes_service.rb
index b9a76dc75a5..8ab1fd2d2a1 100644
--- a/modules/storages/app/services/storages/file_links/set_attributes_service.rb
+++ b/modules/storages/app/services/storages/file_links/set_attributes_service.rb
@@ -27,4 +27,7 @@
#++
class Storages::FileLinks::SetAttributesService < ::BaseServices::SetAttributes
+ def set_default_attributes(_params)
+ model.creator ||= user
+ end
end
diff --git a/modules/storages/lib/api/v3/file_links/create_endpoint.rb b/modules/storages/lib/api/v3/file_links/create_endpoint.rb
index 980ac54a811..de683e3dc11 100644
--- a/modules/storages/lib/api/v3/file_links/create_endpoint.rb
+++ b/modules/storages/lib/api/v3/file_links/create_endpoint.rb
@@ -76,7 +76,6 @@ module API::V3::FileLinks
def params_modifier
->(params) do
- params[:creator_id] = current_user.id
params[:container_id] = work_package.id
params[:container_type] = work_package.class.name
params