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
Add `parent` as a supported link property under `attributesByTimestamp`
Aaron Contrerasacd3847c9ef5
diff --git a/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb b/lib/api/v3/work_packages/work_package_at_timestamp_representer.rbindex 918255b208c..3d3eb521ec2 100644--- a/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb+++ b/lib/api/v3/work_packages/work_package_at_timestamp_representer.rb@@ -51,6 +51,7 @@ module APIprioritytypeversion+ parent].freezeSUPPORTED_PROPERTIES = (SUPPORTED_NON_LINK_PROPERTIES + SUPPORTED_LINK_PROPERTIES).freeze@@ -76,7 +77,7 @@ module APIdef rendered_properties@rendered_properties ||= begin- properties = (changed_properties_as_api_name & SUPPORTED_PROPERTIES) + ['_meta']+ properties = changed_properties_as_api_name.intersection(SUPPORTED_PROPERTIES) + ['_meta']if represented.exists_at_timestamp?properties + ["links", :self]diff --git a/spec/lib/api/v3/work_packages/work_package_at_timestamp_representer_rendering_spec.rb b/spec/lib/api/v3/work_packages/work_package_at_timestamp_representer_rendering_spec.rbindex 143ad1153ac..1828a161aca 100644--- a/spec/lib/api/v3/work_packages/work_package_at_timestamp_representer_rendering_spec.rb+++ b/spec/lib/api/v3/work_packages/work_package_at_timestamp_representer_rendering_spec.rb@@ -50,6 +50,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackageAtTimestampRepresenter, 'renderprioritytypeversion+ parent]end@@ -61,6 +62,13 @@ RSpec.describe API::V3::WorkPackages::WorkPackageAtTimestampRepresenter, 'renderlet(:type) { build_stubbed(:type) }let(:priority) { build_stubbed(:priority) }let(:version) { build_stubbed(:version) }+ let(:parent) do+ build_stubbed(:work_package).tap do |wp|+ allow(wp)+ .to receive(:visible?)+ .and_return(true)+ end+ endlet(:project) { build_stubbed(:project) }let(:work_package) do@@ -73,6 +81,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackageAtTimestampRepresenter, 'rendertype:,priority:,version:,+ parent:,responsible:).tap do |wp|allow(wp).to receive(:respond_to?)@@ -161,6 +170,10 @@ RSpec.describe API::V3::WorkPackages::WorkPackageAtTimestampRepresenter, 'render'href' => api_v3_paths.version(version.id),'title' => version.name},+ 'parent' => {+ 'href' => api_v3_paths.work_package(parent.id),+ 'title' => parent.subject+ },'self' => {'href' => api_v3_paths.work_package(work_package.id, timestamps: timestamp),'title' => work_package.subject@@ -346,6 +359,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackageAtTimestampRepresenter, 'render# "status"=>{"href"=>"/api/v3/statuses/3", "title"=>"status 1"},# "responsible"=>{"href"=>nil},# "assignee"=>{"href"=>"/api/v3/users/68", "title"=>"Bob Bobbit"},+ # "parent"=>{"href"=>"/api/v3/work_packages/102"}# "version"=>{"href"=>nil}}# },# {@@ -400,6 +414,10 @@ RSpec.describe API::V3::WorkPackages::WorkPackageAtTimestampRepresenter, 'render'href' => api_v3_paths.version(version.id),'title' => version.name},+ 'parent' => {+ 'href' => api_v3_paths.work_package(parent.id),+ 'title' => parent.subject+ },'self' => {'href' => api_v3_paths.work_package(work_package.id, timestamps: timestamp),'title' => work_package.subjectdiff --git a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_representer_spec.rbindex ced00a7663a..58dbe85884f 100644--- a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb@@ -1390,7 +1390,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackageRepresenter do.at_path("_embedded/attributesByTimestamp/1/_links/self/href")end- it 'has no information about whether the work package matches the query filters at the timestamp' \+ it 'has no information about whether the work package matches the query filters at the timestamp ' \'because there are no filters without a query' doexpect(subject).not_to have_json_path("_embedded/attributesByTimestamp/0/_meta/matchesFilters")