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
prevent overwriting _type property in SqlCollectionRepresenter subclasses
Christophe Bliard1e4b4f250c87
diff --git a/lib/api/decorators/sql/hal.rb b/lib/api/decorators/sql/hal.rbindex aeff7de219b..f2313a32f68 100644--- a/lib/api/decorators/sql/hal.rb+++ b/lib/api/decorators/sql/hal.rb@@ -52,7 +52,7 @@ module APIselected_properties(select).map do |name, options|representation = if options[:representation]- options[:representation].call(walker_results)+ instance_exec(walker_results, &options[:representation])elseoptions[:column]enddiff --git a/lib/api/decorators/sql_collection_representer.rb b/lib/api/decorators/sql_collection_representer.rbindex 11a958d8ddb..ebca2749cfb 100644--- a/lib/api/decorators/sql_collection_representer.rb+++ b/lib/api/decorators/sql_collection_representer.rb@@ -44,7 +44,7 @@ module APIprivate- def select_from(walker_result)+ def select_from(_walker_result)"projection"end@@ -81,10 +81,14 @@ module APIendendend++ def _type+ 'Collection'+ endendproperty :_type,- representation: ->(*) { "'Collection'" }+ representation: ->(*) { "'#{_type}'" }property :count,representation: ->(*) { "COUNT(*)" }diff --git a/lib/api/v3/work_packages/work_package_sql_collection_representer.rb b/lib/api/v3/work_packages/work_package_sql_collection_representer.rbindex 738375c5150..f7d05f51f69 100644--- a/lib/api/v3/work_packages/work_package_sql_collection_representer.rb+++ b/lib/api/v3/work_packages/work_package_sql_collection_representer.rb@@ -32,8 +32,9 @@ module APIelements: WorkPackageSqlRepresenter}.with_indifferent_access- property :_type,- representation: ->(*) { "'WorkPackageCollection'" }+ def self._type+ 'WorkPackageCollection'+ endendendend