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

Add alias conversion from `status_code` to `status`

Aaron Contreras175831bf56fa
diff --git a/config/constants/ar_to_api_conversions.rb b/config/constants/ar_to_api_conversions.rb
index 9923b945f03..bc5a2fdde3c 100644
--- a/config/constants/ar_to_api_conversions.rb
+++ b/config/constants/ar_to_api_conversions.rb
@@ -35,6 +35,7 @@ module Constants
assigned_to: 'assignee',
version: 'version',
done_ratio: 'percentageDone',
+ status_code: 'status',
estimated_hours: 'estimatedTime',
remaining_hours: 'remainingTime',
spent_hours: 'spentTime',
diff --git a/lib/api/decorators/linked_resource.rb b/lib/api/decorators/linked_resource.rb
index b76d99deda4..a7bc30db1fc 100644
--- a/lib/api/decorators/linked_resource.rb
+++ b/lib/api/decorators/linked_resource.rb
@@ -60,14 +60,16 @@ module API
getter:,
setter:,
link:,
+ as: name,
uncacheable_link: false,
show_if: ->(*) { true },
skip_render: nil,
embedded: true)
- link(link_attr(name, uncacheable_link), &link)
+ link(link_attr(as, uncacheable_link), &link)
property name,
+ as:,
exec_context: :decorator,
getter:,
setter:,
diff --git a/lib/api/v3/projects/copy/project_copy_payload_representer.rb b/lib/api/v3/projects/copy/project_copy_payload_representer.rb
index 18563d0573a..70c1e43d8a8 100644
--- a/lib/api/v3/projects/copy/project_copy_payload_representer.rb
+++ b/lib/api/v3/projects/copy/project_copy_payload_representer.rb
@@ -39,10 +39,6 @@ module API
def meta_representer_class
ProjectCopyMetaRepresenter
end
-
- def writable_attributes
- super + %w[status]
- end
end
end
end
diff --git a/lib/api/v3/projects/project_payload_representer.rb b/lib/api/v3/projects/project_payload_representer.rb
index 079b35e5a35..0956a775daa 100644
--- a/lib/api/v3/projects/project_payload_representer.rb
+++ b/lib/api/v3/projects/project_payload_representer.rb
@@ -33,10 +33,6 @@ module API
include ::API::Utilities::PayloadRepresenter
cached_representer disabled: true
-
- def writable_attributes
- super + %w[status]
- end
end
end
end
diff --git a/lib/api/v3/projects/project_representer.rb b/lib/api/v3/projects/project_representer.rb
index 27a8eba2bde..a919d024462 100644
--- a/lib/api/v3/projects/project_representer.rb
+++ b/lib/api/v3/projects/project_representer.rb
@@ -188,7 +188,8 @@ module API
date_time_property :updated_at
- resource :status,
+ resource :status_code,
+ as: :status,
getter: ->(*) {
next unless represented.status_code