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
Ensure writable call is not removed in payload representer
Oliver Günther82e36f9e149e
diff --git a/lib/api/utilities/payload_representer.rb b/lib/api/utilities/payload_representer.rbindex 6bf7016f785..58c8f271307 100644--- a/lib/api/utilities/payload_representer.rb+++ b/lib/api/utilities/payload_representer.rb@@ -37,9 +37,16 @@ module APIbase.representable_attrs.each do |property|if property.name == 'links'add_filter(property, LinkRenderBlock)- elsif property[:writeable] == false+ next+ end++ writable = property[:writable]+ if writable == falseproperty.merge!(readable: false)- else+ end++ # Only filter unwritable if not a lambda+ unless writable&.respond_to?(:call)add_filter(property, UnwriteablePropertyFilter)endenddiff --git a/lib/api/v3/projects/project_representer.rb b/lib/api/v3/projects/project_representer.rbindex 2e91d888559..a9a1adfa569 100644--- a/lib/api/v3/projects/project_representer.rb+++ b/lib/api/v3/projects/project_representer.rb@@ -162,18 +162,6 @@ module APIdate_time_property :updated_at- property :status_explanation,- getter: ->(*) {- status_obj = status || Project::Status.new- ::API::Decorators::Formattable.new(status_obj.explanation,- object: self,- plain: false)- },- setter: ->(fragment:, **) {- self.status ||= {}- status[:explanation] = fragment["raw"]- }-property :status,render_nil: true,getter: ->(*) {@@ -191,6 +179,20 @@ module APIend}+ property :status_explanation,+ writable: -> do+ represented.writable?(:status)+ end,+ getter: ->(*) {+ ::API::Decorators::Formattable.new(status&.explanation,+ object: self,+ plain: false)+ },+ setter: ->(fragment:, **) {+ self.status ||= {}+ status[:explanation] = fragment["raw"]+ }+def _type'Project'end