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

hide internal cf value format

ulferts23f6d97ccfb0
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 221dff87e12..7951a3d04e7 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -191,6 +191,7 @@ module CustomFieldsHelper
OpenProject::CustomFieldFormat
.all_for_field(custom_field)
.sort_by(&:order)
+ .reject { |format| format.label.nil? }
.map do |custom_field_format|
[label_for_custom_field_format(custom_field_format.name), custom_field_format.name]
end
diff --git a/config/initializers/custom_field_format.rb b/config/initializers/custom_field_format.rb
index a69f0f2a9f7..3c76a2e0ccb 100644
--- a/config/initializers/custom_field_format.rb
+++ b/config/initializers/custom_field_format.rb
@@ -56,10 +56,6 @@ OpenProject::CustomFieldFormat.map do |fields|
label: :label_boolean,
order: 7,
formatter: 'CustomValue::BoolStrategy')
- fields.register OpenProject::CustomFieldFormat.new('empty',
- label: :label_empty,
- order: 7,
- formatter: 'CustomValue::EmptyStrategy')
fields.register OpenProject::CustomFieldFormat.new('user',
label: Proc.new { User.model_name.human },
only: %w(WorkPackage TimeEntry
@@ -74,4 +70,10 @@ OpenProject::CustomFieldFormat.map do |fields|
edit_as: 'list',
order: 9,
formatter: 'CustomValue::VersionStrategy')
+ # This is an internal formatter used as a fallback in case a value is not found.
+ # Setting the label to nil in order to avoid it becoming available for selection as a custom value format.
+ fields.register OpenProject::CustomFieldFormat.new('empty',
+ label: nil,
+ order: 10,
+ formatter: 'CustomValue::EmptyStrategy')
end