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 attribute "name" to ViewRepresenter

Wieland Lindenthalc0faea6cbf99
diff --git a/lib/api/v3/views/view_representer.rb b/lib/api/v3/views/view_representer.rb
index 44e5c26b6ee..882ce9061d9 100644
--- a/lib/api/v3/views/view_representer.rb
+++ b/lib/api/v3/views/view_representer.rb
@@ -78,6 +78,11 @@ module API
query.starred
}
+ property :name,
+ getter: ->(*) {
+ query.name
+ }
+
date_time_property :created_at
date_time_property :updated_at
diff --git a/spec/lib/api/v3/views/view_representer_rendering_spec.rb b/spec/lib/api/v3/views/view_representer_rendering_spec.rb
index d2b79861c54..23f7bf103ef 100644
--- a/spec/lib/api/v3/views/view_representer_rendering_spec.rb
+++ b/spec/lib/api/v3/views/view_representer_rendering_spec.rb
@@ -93,6 +93,14 @@ describe ::API::V3::Views::ViewRepresenter, 'rendering' do
end
end
+ describe 'name' do
+ context 'with the query being name' do
+ it_behaves_like 'property', :name do
+ let(:value) { query.name }
+ end
+ end
+ end
+
describe 'timestamps' do
it_behaves_like 'datetime property', :createdAt do
let(:value) { view.created_at }