From 0f7b6be8ae094b2d5e19da797b6bb9f4dc7d769b Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Wed, 13 May 2026 17:46:35 +0200 Subject: [PATCH] allow deleting calculated value custom fields without enterprise token --- app/contracts/custom_fields/delete_contract.rb | 4 ++++ spec/contracts/custom_fields/delete_contract_spec.rb | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/app/contracts/custom_fields/delete_contract.rb b/app/contracts/custom_fields/delete_contract.rb index bf483055e13..3e065c8db03 100644 --- a/app/contracts/custom_fields/delete_contract.rb +++ b/app/contracts/custom_fields/delete_contract.rb @@ -53,6 +53,10 @@ module CustomFields validate :not_referenced + def validate_model? + false + end + def not_referenced referencing = model.class.with_formula_referencing(model) return if referencing.empty? diff --git a/spec/contracts/custom_fields/delete_contract_spec.rb b/spec/contracts/custom_fields/delete_contract_spec.rb index 65a5a92abd3..207fbc47a04 100644 --- a/spec/contracts/custom_fields/delete_contract_spec.rb +++ b/spec/contracts/custom_fields/delete_contract_spec.rb @@ -60,4 +60,11 @@ RSpec.describe CustomFields::DeleteContract do include_examples "contract is invalid", base: :referenced_in_other_fields end end + + describe "allows deleting a calculated_value field without an enterprise token" do + let(:current_user) { build_stubbed(:admin) } + let(:cf) { build_stubbed(:project_custom_field, field_format: "calculated_value") } + + include_examples "contract is valid" + end end