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

Test admin-only boolean being saved correctly.

Dombi Attila9355fa1de34b
diff --git a/app/models/permitted_params.rb b/app/models/permitted_params.rb
index 4117169935a..6507f0ae91d 100644
--- a/app/models/permitted_params.rb
+++ b/app/models/permitted_params.rb
@@ -472,7 +472,7 @@ class PermittedParams
:possible_values,
:regexp,
:searchable,
- :visible,
+ :admin_only,
:default_value,
:possible_values,
:multi_value,
diff --git a/spec/features/admin/project_custom_fields/create_spec.rb b/spec/features/admin/project_custom_fields/create_spec.rb
index d622dbb4ea3..ea874cdf6d4 100644
--- a/spec/features/admin/project_custom_fields/create_spec.rb
+++ b/spec/features/admin/project_custom_fields/create_spec.rb
@@ -62,6 +62,7 @@ RSpec.describe "Create project custom fields", :js do
fill_in("custom_field_name", with: "New custom field")
select(section_for_select_fields.name, from: "custom_field_custom_field_section_id")
+ check "Admin-only"
click_on("Save")
@@ -74,6 +75,7 @@ RSpec.describe "Create project custom fields", :js do
latest_custom_field = ProjectCustomField.reorder(created_at: :asc).last
expect(latest_custom_field.name).to eq("New custom field")
+ expect(latest_custom_field.admin_only).to be(true)
expect(latest_custom_field.project_custom_field_section).to eq(section_for_select_fields)
end
diff --git a/spec/models/permitted_params_spec.rb b/spec/models/permitted_params_spec.rb
index e297452d93f..7d6f72355f0 100644
--- a/spec/models/permitted_params_spec.rb
+++ b/spec/models/permitted_params_spec.rb
@@ -301,7 +301,7 @@ RSpec.describe PermittedParams do
let(:attribute) { :custom_field }
let(:hash) do
- { "editable" => "0", "visible" => "0" }
+ { "editable" => "0", "admin_only" => "0" }
end
it_behaves_like "allows params"