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
Use the correct filter for linking to time entries
Klaus Zanders5ee9642795c3
diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rbindex acf460e349e..ea21abee85d 100644--- a/lib/api/v3/work_packages/work_package_representer.rb+++ b/lib/api/v3/work_packages/work_package_representer.rb@@ -308,7 +308,10 @@ module APIcache_if: -> { view_time_entries_allowed? } donext if represented.new_record?- filters = [{ work_package_id: { operator: "=", values: [represented.id.to_s] } }]+ filters = [+ { entity_type: { operator: "=", values: ["WorkPackage"] } },+ { entity_id: { operator: "=", values: [represented.id.to_s] } }+ ]{href: api_v3_paths.path_for(:time_entries, filters:),@@ -672,10 +675,10 @@ module API@view_own_time_entries_allowed = if represented.new_record?current_user.allowed_in_any_work_package?(:view_own_time_entries,- in_project: represented.project)- else- current_user.allowed_in_work_package?(:view_own_time_entries, represented)- end+ in_project: represented.project)+ else+ current_user.allowed_in_work_package?(:view_own_time_entries, represented)+ endenddef log_time_allowed?diff --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 cfd60f46e64..32a00bf7d42 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@@ -1018,7 +1018,10 @@ RSpec.describe API::V3::WorkPackages::WorkPackageRepresenter dolet(:link) { "timeEntries" }let(:href) doapi_v3_paths.path_for(:time_entries,- filters: [{ work_package_id: { operator: "=", values: [work_package.id.to_s] } }])+ filters: [+ { entity_type: { operator: "=", values: ["WorkPackage"] } },+ { entity_id: { operator: "=", values: [work_package.id.to_s] } }+ ])endlet(:title) { "Time entries" }end