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

baseline api: have the representer include the baseine-attributes properties only when they are present

Sebastian Fiedlschuster2acabedfdc29
diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rb
index 2419158b340..68cf3e5427a 100644
--- a/lib/api/v3/work_packages/work_package_representer.rb
+++ b/lib/api/v3/work_packages/work_package_representer.rb
@@ -445,12 +445,13 @@ module API
property :baseline_attributes,
as: :baselineAttributes,
+ if: ->(*) { respond_to?(:baseline_attributes) and baseline_attributes.present? },
embedded: true,
uncachable: true
property :attributes_by_timestamp,
as: :attributesByTimestamp,
- if: ->(*) { respond_to?(:attributes_by_timestamp) and attributes_by_timestamp.any? },
+ if: ->(*) { respond_to?(:attributes_by_timestamp) and attributes_by_timestamp.present? },
embedded: true,
uncachable: true