Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#59765] disable hierarchy cfs from custom actions #17289

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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