Skip to content

Commit

Permalink
Merge pull request #17289 from opf/bug/59765-custom-fields-of-type-hi…
Browse files Browse the repository at this point in the history
…erarchy-are-configurable-as-searchable

[#59765] disable hierarchy cfs from custom actions
  • Loading branch information
Kharonus authored Nov 28, 2024
2 parents 4400678 + fc165bf commit e6b4289
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/custom_actions/actions/custom_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def apply(work_package)

def self.all
WorkPackageCustomField
.order(:name)
.usable_as_custom_action
.map do |cf|
create_subclass(cf)
end
Expand Down
5 changes: 5 additions & 0 deletions app/models/work_package_custom_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class WorkPackageCustomField < CustomField
end
}

scope :usable_as_custom_action, -> {
where.not(field_format: %w[hierarchy])
order(:name)
}

def self.summable
where(field_format: %w[int float])
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/custom_actions/actions/custom_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
describe ".all" do
before do
allow(WorkPackageCustomField)
.to receive(:order)
.to receive(:usable_as_custom_action)
.and_return(custom_fields)
end

Expand Down

0 comments on commit e6b4289

Please sign in to comment.