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
hide parent selector for portfolios
ulfertscd762191bba3
diff --git a/app/forms/projects/settings/relations_form.rb b/app/forms/projects/settings/relations_form.rbindex ced943e30c8..095e3459647 100644--- a/app/forms/projects/settings/relations_form.rb+++ b/app/forms/projects/settings/relations_form.rb@@ -49,6 +49,10 @@ module Projectsprivate+ def render?+ model.project?+ end+def project_autocompleter_modelreturn nil unless parentreturn { id: parent.id, name: I18n.t(:"api_v3.undisclosed.parent") } unless parent.visible? || User.current.admin?diff --git a/spec/features/portfolios/create_spec.rb b/spec/features/portfolios/create_spec.rbindex eb703544b7f..d0b053c4211 100644--- a/spec/features/portfolios/create_spec.rb+++ b/spec/features/portfolios/create_spec.rb@@ -48,6 +48,11 @@ RSpec.describe "Portfolios",visit new_portfolio_pathexpect(page).to have_heading "New portfolio"+ # This should be an+ # expect(page).to have_no_field "Subproject of"+ # But this leads to a false negative. Even with the field being there, is the+ # expectation passed.+ expect(page).to have_no_content "Subproject of"fill_in "Name", with: "Foo bar"click_on "Create"@@ -58,9 +63,21 @@ RSpec.describe "Portfolios",expect(page).to have_content "Foo bar"end- it "cannot create the portfolio without the feature flag being active", with_flag: { portfolio_models: false } do- visit new_portfolio_path+ context "without the necessary permissions to create portfolios", with_flag: { portfolio_models: true } do+ current_user { create(:user) }++ it "cannot create the portfolio" do+ visit new_portfolio_path++ expect(page).to have_content "[Error 403] You are not authorized to access this page."+ end+ end++ context "without the feature flag being active", with_flag: { portfolio_models: false } do+ it "cannot create the portfolio" do+ visit new_portfolio_path- expect(page).to have_content "[Error 403] You are not authorized to access this page."+ expect(page).to have_content "[Error 403] You are not authorized to access this page."+ endendend