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

Remap status_attributes from representable back to status

Oliver Günther4963a9b0e1f7
diff --git a/app/services/projects/set_attributes_service.rb b/app/services/projects/set_attributes_service.rb
index 8d64bda46dc..f462098a567 100644
--- a/app/services/projects/set_attributes_service.rb
+++ b/app/services/projects/set_attributes_service.rb
@@ -33,10 +33,7 @@ module Projects
private
def set_attributes(attributes)
- # Delete the status attribute which gets set by representable
- # IFF the status_code is given as null
- attributes.delete(:status)
- status_attributes = attributes.delete(:status_attributes) || {}
+ status_attributes = attributes.delete(:status) || {}
ret = super(attributes)
diff --git a/lib/api/v3/projects/project_representer.rb b/lib/api/v3/projects/project_representer.rb
index 06a5396d54b..6d83682be4c 100644
--- a/lib/api/v3/projects/project_representer.rb
+++ b/lib/api/v3/projects/project_representer.rb
@@ -50,7 +50,10 @@ module API
# Representable is broken when passing nil as parameters
# it will set the property :status and :statusExplanation
# regardless of what the setter actually does
- super.except(:status, :statusExplanation)
+ super.tap do |result|
+ result.except!(:status, :statusExplanation)
+ result[:status] = result.delete(:status_attributes) if result.key?(:status_attributes)
+ end
end
link :createWorkPackage,