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
Fix/nil parent rendering (#9339)
ulferts4cd75489ffbc
diff --git a/config/locales/en.yml b/config/locales/en.ymlindex f5c9f2ae4d2..311319175e6 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2787,9 +2787,6 @@ en:total_progress: "Total progress"- undisclosed:- parent: Undisclosed - The selected parent is invisible because of lacking permissions.-user:all: "all"active: "active"@@ -2934,6 +2931,9 @@ en:resources:schema: 'Schema'+ undisclosed:+ parent: Undisclosed - The selected parent is invisible because of lacking permissions.+doorkeeper:pre_authorization:status: 'Pre-authorization'diff --git a/lib/api/decorators/linked_resource.rb b/lib/api/decorators/linked_resource.rbindex 5128d7ff30f..7fa2cdf08f1 100644--- a/lib/api/decorators/linked_resource.rb+++ b/lib/api/decorators/linked_resource.rb@@ -186,7 +186,7 @@ module APIif undisclosed && instance_exec(&skip_link){href: API::V3::URN_UNDISCLOSED,- title: I18n.t(:"undisclosed.#{name}")+ title: I18n.t(:"api_v3.undisclosed.#{name}")}elsif !instance_exec(&skip_link)::API::Decorators::LinkObjectdiff --git a/lib/api/v3/projects/project_representer.rb b/lib/api/v3/projects/project_representer.rbindex fb93abbc3ac..33daac614d0 100644--- a/lib/api/v3/projects/project_representer.rb+++ b/lib/api/v3/projects/project_representer.rb@@ -158,7 +158,7 @@ module APIrepresenter: ::API::V3::Projects::ProjectRepresenter,uncacheable_link: true,undisclosed: true,- skip_render: ->(*) { !represented.parent&.visible? }+ skip_render: ->(*) { represented.parent && !represented.parent.visible? }property :idproperty :identifier,diff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rbindex 2d4baa086cd..c2ae1bb24b9 100644--- a/spec/features/projects/edit_settings_spec.rb+++ b/spec/features/projects/edit_settings_spec.rb@@ -192,7 +192,7 @@ describe 'Projects', 'editing settings', type: :feature, js: true dofill_in 'Name', with: 'New project name'- parent_field.expect_selected I18n.t(:'undisclosed.parent')+ parent_field.expect_selected I18n.t(:'api_v3.undisclosed.parent')click_on 'Save'diff --git a/spec/lib/api/v3/projects/project_representer_rendering_spec.rb b/spec/lib/api/v3/projects/project_representer_rendering_spec.rbindex 08bcd692949..7a07b75f27e 100644--- a/spec/lib/api/v3/projects/project_representer_rendering_spec.rb+++ b/spec/lib/api/v3/projects/project_representer_rendering_spec.rb@@ -215,7 +215,16 @@ describe ::API::V3::Projects::ProjectRepresenter, 'rendering' doit_behaves_like 'has a titled link' dolet(:link) { 'parent' }let(:href) { API::V3::URN_UNDISCLOSED }- let(:title) { I18n.t(:'undisclosed.parent') }+ let(:title) { I18n.t(:'api_v3.undisclosed.parent') }+ end+ end++ context 'without a parent' do+ let(:parent_project) { nil }++ it_behaves_like 'has an untitled link' do+ let(:link) { 'parent' }+ let(:href) { nil }endendend